• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Advice on the book to go in data structure

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Geeks!

I am seeking a way through / advice!

I am new in this Forum and this is my First Post. I have graduated in IT some 4 years back and I was out of IT/programming, I was teaching some Maths in a school and now I want to get back to professional as a programmer. Now I trying to get in coding to make myself in rails/fit! I have started with this free book Introduction to Programming Using Java, Seventh Edition. Its my wish to get back to school again for the Masters of Computer Science. This is the school I want to get admitted Maharishi University of Management, USA as soon as I am ready.

The school need me to pass this kind of sample test I have append below. In the book, I am studying, now am in recursion. But this book builds its code long and complicates examples such as cards with some classes (yes its OOP), but my test just need a small function with a strong thinking I guess. So here come my request. Please my you advice me on the book which will favour this, data structures functions, small functions which needs some thinking to get right. I want to score 100% on the test day.

Thats all for now, thanks in advance.



1. [Tests problem solving and a little bit of Java language] Write a Java method removeDuplicates that removes all duplicates in a given list. Assume the following:

a. The method accepts an object of type List

b. The return type of the method is void

c. Duplicates are determined using the equals() method (rather than by the == operator)

Your implementation of removeDuplicates should handle, in an appropriate way, the case in which a null List is passed in to the method.

Test your method by writing code in a main method, which does the following:

a. It creates an instance of List and loads it with the following String values:{“good”, “better”, “best”, “best”, “first”, “last”, “last”, “last”,”good”}

b. It invokes the removeDuplicatesMethod, passing in this instance of List

c. It outputs the modified list to the console

2. [Tests Java language and prob solving] Write a Java method testForSum which determines whether a given array of integers contains three entries whose sum is equal to a given integer. Assume the following:

a. The method accepts an array intArr of int’s and an int testInt as its two arguments

b. The return type of the method is boolean

c. The method returns true if and only if there are distinct integers i, j, k such that intArr[i] + intArr[j] + intArr[k] equals testInt.

Test your method in a main method, which passes the following input values

{5, 1, 23, 21, 17, 2, 3, 9, 12}, 22

into the method testForSum, and which outputs the return value to the console.

3. [Tests knowledge of data structures] Create your own linked list (do not use any of the classes provided in the Collections API). Implement the following two operations:

If you are using jdk1.4 or before:

void add(Object ob);

boolean find(Object ob);

String toString();

If you are using j2se5.0 and you know generic programming:

void add(T ob);

boolean find(T ob);

String toString()

The toString method should arrange the elements of the list in a comma-separated sequence, in the following format:

[elem0, elem1, elem2, …, elemN]

Test your linked list in a main method which does the following:

a. Creates an instance of your list and adds the following Strings to it:

“Straight”, “Bent”, “Equals”, “Well”, “Storm”

b. Uses your find function to search for the keys “Well” and “Strength”

c. Outputs both the input list and the search results to the consoleand output the results to the consoleby repeatedly using your add function to populate a new instance of your linked list with Strings, and then outputting to console the boolean result of searching for some String in this list.

4. [Tests basic knowledge of recursion] Write a recursive static Java method that accepts an array arr of integers argument returns a list of all permutations of these integers.

(A permutation of a sequence of integers is a re-arrangement of the integers. For example, one permutation of 1, 3, 4, 8, 2 is 3, 1, 2, 8, 4.) For this problem, you may assume that the input array contains no duplicate entries. Your method should return an ArrayList of int arrays.

Next, test your method using a main method; the main method should pass in the following array: [1, 5, 4, 2]; then, it should print to the console the resulting list of permutations.

5. [Tests knowledge of concept of static] Create a Java class that allows at most 5 instances of itself to be created. Call your class JustFive. Provide a main method in your class that attempts to create 6 instances of your class.
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

There were problems with the links you posted but I have corrected them. I have also changed your red text to black because red text is too intrusive and some people find it difficult to read. We don't supply compete solutions so if you want comments on the code please post it here and let us have a look at it.
Before you spend time going to the bookshop and spend money buying something, have a look at the Java™ Tutorials, which may answer your questions for a few clicks.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic