I am looking for the Diagrams for these questions So Q1 (b) and Q2 (b), (c), and
ID: 3602525 • Letter: I
Question
I am looking for the Diagrams for these questions
So Q1 (b) and Q2 (b), (c), and (d)
ntene E Emphasis Head ng INormalStrong-Subtitle Title 1NoSpac Subtle Em.. Intense E Assignment 5 (Based on Chapter 7) Due: October 26, 2017 Q.1 Following figure is a hand-sketched DFD of data movement in a famous tour agency Qu Trale No Spac. Subtle Em Styles called A-One World Tour. Examine it and answer the questions (a) and (b). A hand-sketched data flow diagram for Marilyn's Tours. DI GOST OF TOURS PRIVATE AGENT TRAVEL AGENT CASH PAYING TOURIST WITH CHARGE CARD Make D31 TRAVEL ITINERARY DY CREDIT HESTORY (a) There are some errors on this DFD which are not permitted in DFD List the errors. (6) (b). Besides the errors, this DFD is confusing and the reader may not be able to interpret it correctly. Using Visible Analyst redraw the DFD so that it is readable and the errors are removed. If needed, you may add a new process, new data flow, new entity t morc meaningful. o make DFDExplanation / Answer
import java.util.*;
class Dynamic
{
ArrayList<Integer> arr;
HashMap<Integer, Integer> hash;
public MyDS()
{
arr = new ArrayList<Integer>();
hash = new HashMap<Integer, Integer>();
}
void add(int x)
{
if (hash.get(x) != null)
return;
int s = arr.size();
arr.add(x);
hash.put(x, s);
}
void remove(int x)
{
Integer index = hash.get(x);
if (index == null)
return;
hash.remove(x);
int size = arr.size();
Integer last = arr.get(size-1);
Collections.swap(arr, index, size-1);
arr.remove(size-1);
hash.put(last, index);
}
int getRandom()
{
Random rand = new Random();
int index = rand.nextInt(arr.size());
return arr.get(index);
}
Integer search(int x)
{
return hash.get(x);
}
}
class Main
{
public static void main (String[] args)
{
Dynamic ds = new Dynamic();
ds.add(10);
ds.add(20);
ds.add(30);
ds.add(40);
System.out.println(ds.search(30));
ds.remove(20);
ds.add(50);
System.out.println(ds.search(50));
System.out.println(ds.getRandom());
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.