Recaip Sanli

Ranch Hand
+ Follow
since Sep 06, 2016
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Recaip Sanli

Thank you Carey! This is why person with great details do well in software engineering!
6 years ago
I knew it had to be something ridiculously simple
6 years ago
Any idea why this code would skip line 13 even when i=1 charAt(i) is 0 and if comparison should be true and increment count. But it would never get in there. So confused.


6 years ago
Thank you Campbell Ritchie
7 years ago
@Knute Snortum
First five lines in the Pseudocode shows initialization of variables. It's got two index and two numbers. Are they all int? The second part of index and number variables cannot be int, they must be int[].

@Campbell Ritchie
Most of the java files I put on this question is written by my instructor. This is my assignment. He didn't go over the Prim's algorithm code and I have no clue what is happening with it.

Going over someone elses code is harder than writing from scratch, especially when you have no idea how implementation of certain algorithm should be like.

I understand the concept of Prim's algorithm, but implementation, no idea.
I feel like I need to learn how to implement first from some youtube video, understand the kind of implementation instructor did and figure out what I need to do to make it work. Is this the only viable way?
7 years ago
I am totally lost, have no idea even where to start on this. If you understand and have a clear suggestion, please let me know. I don't understand what this pseudocode code, can't even translate it.

Prim's Algorithm Pseudocode


Question

This method takes as parameters an int n which is the number of vertices in the graph, an adjacency matrix held in a two-dimensional int array W, as well as an edge set F simulated by an array of the Edge class. The method implements the Prim’s minimum spanning tree algorithm (Algorithm 4.1 on page 160 in the textbook) and returns the nearest array. The Edge array F is already initialized with n – 1 slots (only n – 1 edges are needed) in the test driver so you don’t have to do it in this method. You need to make sure that after the method call is completed, F should have all the edges in the minimum spanning tree.

I uploaded provided Java files here:
https://ufile.io/4zvrc

Also entered them in text format below:
Edge.java



Homework4.java




TestHomework4.java
7 years ago
Below code queries the Database for PL records information and prints it on the page. I am struggling with majorly two things:
1) Printing entered start and end dates and also Company name to the page above the table. Above this "<table class="view-table" id="table">".
2) If total field is equal to 0, I want its whole row to be hidden. I cannot figure out a way to hide it.

I included screenshot of how the application works.


total.php



pl.js




pl.php
Thank you @Junilu Lacar, your cardDemo is much better than the one teacher gave me.

I just hope I won't end up getting a 0 by not figuring out a way to handle what he asked based on the way he's making me do it.

This is why it's better to learn coding yourself rather go to school. You learn from one another group of people and knowledge versus teacher make you code certain way you never really learn how to do certain things better.
7 years ago
Now that I am thinking though, I don't need to swap, I need to override actual array.

In the above code, I am using tempArray to write down the correct sorted object Card array. All I need to do at the end is copy over all tempArray values over to Card object.

How would I do that without setSuit and setRank though?
7 years ago
This is an homework given to me, I didn't really plan this program.

But it does make sense that I need to replace cardArray objects.

I don't know why would anyone write a code to go through merge sort method of each individual cardArray objects. It's totally unuseful and not helpful to understand the concept of merge sort whatsoever.

Thank you!
7 years ago
So cardArray is an object. I get each elements of this objects through getRank, getSuit methods in Card object. There is no setSuit and setRank. When I merge, as far as I know, I need to override values and swap them therefore I need setSuit and setRank methods. Below code fails with the error at the bottom and I am thinking because I am not able to use setSuit, setRank methods. Any ideas?




Deck



Card


TestDrive


Error

7 years ago
Gotcha! It was brackets for the for loop. Sometimes we look into toughest part of the problem yet error is at simplest...
7 years ago
When I run this code, it gives the below error. Does anyone have any idea?




7 years ago
Good news, I came up with super compact answer working on improving a snippet I found.

Thank you for everyone! I truly appreciate every single try and input. I do agree with many of you on writing future in mind and ease of understanding later on!



Test Driver



7 years ago
Good news, I came up with super compact answer working on improving a snippet I found.

Thank you for everyone! I truly appreciate every single try and input. I do agree with many of you on writing future in mind and ease of understanding later on!



Test
7 years ago