Question
Solve these data structure methods in eclipse IDE plz In a separate paper, write down the solution to the following: Generics and Arrays: a) Method
Solve these data structure methods in eclipse IDE plz
In a separate paper, write down the solution to the following:
Generics and Arrays: a) Method shift: It is a generic method. It receives a generic array and shifts all its elements from one index position to the left. For Example, the element in index 1 will be shifted to index 0 and the element in index 0 will be shifted to the last index.
Recursive: b) Method fibonacci: This function uses Recursion. In the Fibonacci series, the next number is the sum of the previous two numbers for example 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, etc. This method will return Fn. For example, if n = 0, then the method should return 0. If n = 1, then it should return 1. For n > 1, it should return Fn-1 + Fn-2
Queue: c) Method removeDivisibleByTen: It receives an integer queue. Then it removes all the numbers that are divisible by 10. The order of the elements in the queue should not change.
Stack: d) Method removeOdd: It receives a stack of integer numbers and removes all odd numbers. The order of the rest elements in the stack should not be changed. The stack is implemented using Singly Linked List. Binary Search
Tree: e) Method nodesInLevel: This function uses Recursion. It returns the number of nodes at a specific level. Note: The root is located at level 0. The children of the root are located at level 1. This method will call another recursive method called countNodes.
Heap: f) Method search: It searches the array for an element with key k, if it is found, it returns that element, otherwise it returns null.
Hash Table:
g) Method insert: It inserts new entries to the has table using the Double Hashing method. This method rehashes all elements before inserting a new element when load factor >=0.4
h) Method insert: It inserts new entries to the has table using the Quadratic Probing method. This method rehashes all elements before inserting a new element when load factor >=0.6
i) Method rehash: It duplicates the size of the table and rehashes all previous elements (Insert again using the insert function). This method works for Double Hashing and Quadratic Probing.
Unweighted Undirected Graphs : Implement the graph using the Adjacency List Structure.
a) Method addVertex: It adds a vertex to the vertices list (Vertex).
b) Method addEdge: It adds links between two vertices.
c) Method printGraph: It prints all the vertices with their links.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started