Đã hoàn thành

Java Structure

we will perform some experiments with Hash Table, Disjoint Set, and

Graph algorithms. You may use the source codes that we have created in the lab exercises folder of the

Q1. [5 marks] We have discussed Disjoint Set ADT in the lab. It performs “union” and “find” operations.

In a simple implementation of union operation, it changes the parent of one set to another set without

considering any weight factor of the parent. This can create a skewed tree and search may become

inefficient. Create a DisjointSetADT class with “Union” and “Find” operations. In the union operation

consider the weight of the parents and make the heavier set as the parent set of the lighter set.

Q2. [5 Marks] Given an array of characters, give an O(n) algorithm (that is you can visit each character

only once) for removing the duplicates. [Hint: use hash table].

Q3. [10 Marks] Given a list of pairs; Give an efficient method (O(n)) to print all “Symmetric Pairs”. A pair

is symmetric if both pair (i, j) and pair (j, i) exist in the list. For example, in { {3, 1}, {2, 6}, {3, 5}, {7, 4}, {5,

3}, {8, 7} } , note that {3, 5} is already present in the list when you encounter {5, 3}, that means they are

symmetric pair, so print this pair when you encounter {5, 3}. [Hint: use hash table]

Algorithm:

1) Read the pairs of elements one by one and insert them into a hash

table. For each pair, consider the first element as a key and

second element as value.

2) While inserting the key elements check if the hashing of the

second element of the current pair is the same as the first

number of the current pair.

3) If they are the same, this means that the pairs are symmetric and

output that pair.

4) Otherwise, insert that element into that. That means, use the

first number of the pair as key and the second number as value

and insert them into the hash table.

5) By the time we complete the scanning of all pairs, we have output

all the symmetric pairs.

Q4. [5 Marks] Given an unweighted directed graph G, write a program that counts and prints all simple

paths from a given ‘s’ to a given ‘d’. Assume the graph G is represented using adjacent matrix.

Q5 [5 Marks] Write a program to determine whether a given unweighted undirected graph G contains a

cycle or not.

Q6. [5 Marks] Implement the GraphADT using Adjacency List and test it with BFS search.

Q7. [15 Marks] There is a maze of size N x N. You are designing a robot that can traverse through the

maze and find the exit point. You can select a starting point in the maze ‘S’ and there is only one exist

point marked as ‘E’. Your robot needs to find the shortest path (with minimum energy cost) from 'S' to

'E' in the maze.

➔ The robot can only move left (L), right (R), up (U) and down (D) from a cell.

➔ An empty cell in a maze is represented as ‘.’

➔ Once the robot moves from one cell, it loses one unit of energy.

➔ There are some obstacles in some cells (marked as ‘R’), the robot cannot pass through them.

➔ You cannot cross the boundary of the maze.

➔ If there is no path then print -1, otherwise print the shortest path (in terms of move) from

‘S’ to ‘E’.

Sample input and output format (please strictly follow these formats in your code).

Sample 1

Input:

4 (this is the value of the N, which means the maze is a 4x4 maze)

. . . S

. R R .

. . R R

R . . E

Output: 9 moves.

L L L D D R D R R

Sample 2

5

. . S . R

. R R . .

. . R R E

R . . . R

R . . . R

Output: 4 moves.

R D R D

Sample 3

5

. . S . R

. R R . .

. R . R R

R . . E .

R . . . R

Output: -1

Kĩ năng: Java

Xem nhiều hơn: java allow scripts check urls, java url available check, simple java program inventory check, fundamental programming structures in java, java program structure in hindi, structure of java program tutorialspoint, structure of java program wikipedia, structure of java program ppt, java application structure, how to initialize a struct in java, how to implement structure in java, java sudoku code check, java random generate number percentage right yes, java spaceship collision check, java bypass hotmail check, java mysql login check, java url availability check, java copy progress check, java excel file check, java project managment check task

Về Bên Thuê:
( 3 nhận xét ) kamloops, Canada

ID dự án: #22616907

Được trao cho:

developerpoint11

Hello i am a Java Developer and i want to do your project in your given deadline. My Main focus is give you a good result according to your requirements. Hope you get a good result after hiring me. Thanks!

$100 CAD trong 1 ngày
(0 Đánh Giá)
0.0

5 freelancer đang chào giá trung bình $56 cho công việc này

iridescent2x15

Hi I have done many java projects. You can share more details of your java project in chat. Thank you

$30 CAD trong 7 ngày
(56 Nhận xét)
5.9
rajitravindran

Am very strong in Data Structures and algorithms I know solutions to all the above questions I am a professional Java and Node(both express and koajs) web developer(Senior Software Engineer) with 7+ years of experie Thêm

$100 CAD trong 7 ngày
(17 Nhận xét)
4.8
richikchanda1999

I am a Java programmer and quite fluent with Data Structures like Graph, Disjoint Sets and Algorithms like Breadth First Search (which will be applied in most of the problems here). I can do the questions given in 2 da Thêm

$30 CAD trong 2 ngày
(3 Nhận xét)
1.9
Alenaweb

Software Engineering Guru awarded Bachelor's Degree in Computer Science and Technology, I am. Having checked the requirement of this project, I can notice that these types of projects are very familiar to me. I am read Thêm

$20 CAD trong 7 ngày
(0 Nhận xét)
0.0