(See the attached pdf for complete details)
Map Routing:
Implement the classic Dijkstra’s shortest path algorithm and optimize it for maps. Such algorithms are widely used in geographic information systems (GIS) including MapQuest and GPS-based car navigation systems.
Your goal:
Optimize Dijkstra’s algorithm so that it can process thousands of shortest path queries for a given map. Once you read in (and optionally preprocess) the map, your program should solve shortest path problems in sublinear time. One method would be to precompute the shortest path for all pairs of vertices; however you cannot afford the quadratic space required to store all of this information. Your goal is to reduce the amount of work involved per shortest path computation, without using excessive space. We suggest a number of potential ideas below which you may choose to implement. Or you can develop and implement your own ideas.
You need to implement 2 improvement ideas, in order to get full points on the coding part. If you come up with your own ideas, you will get extra credits. (up to 10 points)
Category: Algorithms & Data Structures
Am looking to dashboard either using excel or power BI. The dashboard purpose is
Am looking to dashboard either using excel or power BI. The dashboard purpose is to show following using charts, trends .. :
1- live daily inventory level with minimum and maximum constraints.
2- the planned sales figures for coming month. 3- the planned production daily rate for coming month. 4- figures to present the actual sales compared with planned
5- the dashboard shall be easy to be updated daily
(See the attached pdf for complete details) Map Routing: Implement the classic
(See the attached pdf for complete details)
Map Routing:
Implement the classic Dijkstra’s shortest path algorithm and optimize it for maps.
Such algorithms are widely used in geographic information systems (GIS) including
MapQuest and GPS-based car navigation systems.
Your goal:
Optimize Dijkstra’s algorithm so that it can process thousands of shortest
path queries for a given map. Once you read in (and optionally preprocess) the map,
your program should solve shortest path problems in sublinear time. One method
would be to precompute the shortest path for all pairs of vertices; however you cannot
afford the quadratic space required to store all of this information. Your goal is to
reduce the amount of work involved per shortest path computation, without using
excessive space. We suggest a number of potential ideas below which you may
choose to implement. Or you can develop and implement your own ideas.
You need to implement 2 improvement ideas, in order to get full points on the
coding part. If you come up with your own ideas, you will get extra credits. (up to
10 points)
Q1-Given below is a Java method to remove a node from a binary tree. Your task i
Q1-Given below is a Java method to remove a node from a binary tree. Your task is to:
Write a detailed explanation for each block or segment of the provided code. A block or segment is a logical grouping of lines that perform a specific task or operation together.
Ensure your explanations are clear, concise, and demonstrate your understanding of the code’s functionality.
private BinaryNode
if (t == null)
return t;
int compareResult = x.compareTo(t.element);
if (compareResult < 0)
t.left = remove(x, t.left);
if (compareResult > 0)
t.right = remove(x, t.right);
else if (t.left != null && t.right != null) {
t.element = findMin(t.right).element;
t.right = remove(t.element, t.right);
}
else
t = (t.left != null) ? t.left : t.right;
return t;
}
Q2-Write Java code to use a priority queue to sort numbers in ascending order.
Q3-Compare and contrast any four (4) sorting algorithms based on the following factors:
Time Complexity
Space Complexity
Ease of Implementation
Applications of Algorithm
Q1-Given below is a Java method to remove a node from a binary tree. Your task i
Q1-Given below is a Java method to remove a node from a binary tree. Your task is to:
Write a detailed explanation for each block or segment of the provided code. A block or segment is a logical grouping of lines that perform a specific task or operation together.
Ensure your explanations are clear, concise, and demonstrate your understanding of the code’s functionality.
private BinaryNode
if (t == null)
return t;
int compareResult = x.compareTo(t.element);
if (compareResult < 0)
t.left = remove(x, t.left);
if (compareResult > 0)
t.right = remove(x, t.right);
else if (t.left != null && t.right != null) {
t.element = findMin(t.right).element;
t.right = remove(t.element, t.right);
}
else
t = (t.left != null) ? t.left : t.right;
return t;
}
Q2-Write Java code to use a priority queue to sort numbers in ascending order.
Q3-Compare and contrast any four (4) sorting algorithms based on the following factors:
Time Complexity
Space Complexity
Ease of Implementation
Applications of Algorithm
Q1-Given below is a Java method to remove a node from a binary tree. Your task i
Q1-Given below is a Java method to remove a node from a binary tree. Your task is to:
Write a detailed explanation for each block or segment of the provided code. A block or segment is a logical grouping of lines that perform a specific task or operation together.
Ensure your explanations are clear, concise, and demonstrate your understanding of the code’s functionality.
private BinaryNode
if (t == null)
return t;
int compareResult = x.compareTo(t.element);
if (compareResult < 0)
t.left = remove(x, t.left);
if (compareResult > 0)
t.right = remove(x, t.right);
else if (t.left != null && t.right != null) {
t.element = findMin(t.right).element;
t.right = remove(t.element, t.right);
}
else
t = (t.left != null) ? t.left : t.right;
return t;
}
Q2-Write Java code to use a priority queue to sort numbers in ascending order.
Q3-Compare and contrast any four (4) sorting algorithms based on the following factors:
Time Complexity
Space Complexity
Ease of Implementation
Applications of Algorithm
Q1-Given below is a Java method to remove a node from a binary tree. Your task i
Q1-Given below is a Java method to remove a node from a binary tree. Your task is to:
Write a detailed explanation for each block or segment of the provided code. A block or segment is a logical grouping of lines that perform a specific task or operation together.
Ensure your explanations are clear, concise, and demonstrate your understanding of the code’s functionality.
private BinaryNode
if (t == null)
return t;
int compareResult = x.compareTo(t.element);
if (compareResult < 0)
t.left = remove(x, t.left);
if (compareResult > 0)
t.right = remove(x, t.right);
else if (t.left != null && t.right != null) {
t.element = findMin(t.right).element;
t.right = remove(t.element, t.right);
}
else
t = (t.left != null) ? t.left : t.right;
return t;
}
Q2-Write Java code to use a priority queue to sort numbers in ascending order.
Q3-Compare and contrast any four (4) sorting algorithms based on the following factors:
Time Complexity
Space Complexity
Ease of Implementation
Applications of Algorithm
1. Tree problems. (a) [10 points] Traverse the following binary tree using the
1. Tree problems.
(a) [10 points] Traverse the following binary tree using the four traversal algo
rithms: Preorder traversal, inorder traversal, postorder traversal, and level
order (or breadth-first) traversal.
(b) [10 points] Draw the binary search tree that results from the following op
erations in that order into an initially empty binary search tree: insert 70,
insert 40, insert 30, insert 80, insert 50, insert 20, delete 50, insert 90, insert
10, delete 70, insert 70. You are only required to show the final tree.
(c) [10 points] Draw the (2, 4) tree that results from the following operations in
that order into an initially empty tree: insert 70, insert 40, insert 30, insert
80, insert 50, insert 20, insert 90, insert 10, insert 70, insert 100, insert 60.
You are only required to show the final tree
2. Heap problems.
(a) [5 points] Draw the min-heap (tree representation) that results from the fol
lowing operations in that order into an initially empty min heap: insert 30,
insert 40, insert 10, deletemin, insert 20, insert 30, deletemin, insert 40, in
sert 20, insert 70, insert 50, deletemin, insert 60, insert 20. You should not
insert duplicate elements into the heap. You are only required to show the
f
inal tree.
1
(b) [10 points] Givenanarray, designanefficientalgorithm ISMINHEAP(A[1 n])
to check if the array represents a min-heap.
(c) [10 points] Given an array of integers A[1 n], design an efficient algorithm
COMPUTELARGESTELEMENTS(A[1 n],k)tocomputethek largestelements
of the array using a heap?
(d) [10 points] Given a minheapandakeyk,designanefficientalgorithm COM
PUTESMALLESTELEMENTSGIVENKEY(A[1 n], k)tocompute all the entries
in the heap having keys less than or equal to k. Your algorithm should run in
time proportional to the number of entries returned, and should not modify
the heap.
3. Hash table problems.
(a) [10 points] Given an array A[1 n] and a sum s, design an efficient algo
rithm EXISTSPAIR(A[1 n] s) that uses a hash table to find and return a
pair (A[i]A[j]) such that i j, that adds to sum s, i.e., A[i] + A[j] = s. If there
is no such pair, return null.
(b) Draw the 11-entry hash table that results from using the hash function H(i) =
(3 i+7) mod 11, to hash the keys 12441388239411392016and5, assum
ing collisions are handled by:
(a) [5 points] Chaining
(b) [5 points] Linear probing
(c) [5 points] Quadratic probing
4. Graph problems.
Consider the following graph. Assume that the traversals are considered in al
phabetical order and all adjacency lists are given in alphabetical order. Starting
from vertex m, showtheordering of vertices produced by the following algorithms.
(a) [5 points] Depth-first search
(b) [5 points] Breadth-first search
The file P09_01.xlsx contains a random sample of 100 lightbulb lifetimes. The co
The file P09_01.xlsx contains a random sample of
100 lightbulb lifetimes. The company that produces
these lightbulbs wants to know whether it can claim
that its lightbulbs typically last more than 1000 burning hours.
a. Identify the null and alternative hypotheses for this
situation.
b. Can this lightbulb manufacturer claim that its
lightbulbs typically last more than 1000 hours at
the 5% significance level? What about at the 1%
significance level? Explain your answers
The Traveling Salesman Problem Given a collection of cities, along with pairwise
The Traveling Salesman Problem
Given a collection of cities, along with pairwise distances between the cities, what is the
shortest route that visits each city exactly once and returns the the starting city? This
question is commonly referred to as the traveling salesman problem (TSP). The traveling
salesman problem can be reformulated as finding a Hamiltonian cycle of least cost in a
weighted graph — a Hamiltonian cycle is a cycle that includes every vertex in the graph.
This assignment will focus on a brute-force solution to the traveling salesman problem.
Program Specifications
You will write a C++ program to implement a brute-force, permutation-based solution for
the traveling salesman problem. Your program will take in a single command line input
specifying a file to read. The input file will contain one or more lines, each of which specifies
a directed edge the form “src dst wt” where src and dst are non-negative integers indicating
the source and destination vertices of the edge, and wt is the weight of the edge. I will
provide you with sample input files for testing, but it is your responsibility make sure that
your program behaves correctly on any valid input file. Your program will output the cost
of the minimum Hamiltonian cycle. See the end of this handout for example output.
You will need to implement your own adjacency matrix or adjacency list structure to store the
graph. Take care not to over engineer your data structure — you do not need to write a full
class to implement your graph data structure. I suggest that you rely on standard template
library containers for your implementation (see https://cplusplus.com/reference/stl/). For
instance
• std::vector > adj matrix;
• std::vector > adj list;
Regardless of the data structure you choose, do not hard-code limits on your data structure
size. Also, please note that variable-length arrays (VLAs) are not part of the C++ standard
and should not be used. For your solution, you make use the std::next permutation
function.
Submission and Grading
You must use skeleton3.cpp (see iLearn) as a starting point for your program, and complete
the TSP function; feel free to create any additional helper functions or include any additional
standard libraries that you need, but do not modify any other existing functions. Your
source code should be contained in a single file and should be named after your TTU email
address excluding the “@tntech.edu” (e.g., jagraves21.cpp). All submissions will be made
on iLearn — please do not zip or compress your files. Make sure to follow best coding
practices (proper naming conventions, useful comments, etc.). Your program should compile
without errors or warnings. Programs will be compiled using the following command:
g++ -Wall -pedantic -std=c++11 [source file]
Sample Output
The following lines contain sample input and expected output to your programs. Please note
that these examples are not exhaustive, and you should verify your programs with additional
test cases.
$ ./a.out graph1.txt
18
$ ./a.out graph2.txt
14
$ ./a.out graph3.txt
No Hamiltonian cycle exists.