Advertisement
udaykumar1997

DFDFDD

Feb 25th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.75 KB | None | 0 0
  1. --------------------------
  2. Post Title 'DAA Assignment-1 Answers'
  3. Post by user 'Adusumilli-Uday-Kumar'
  4. Post encryped with secure 256-bit MD5 Encryption
  5. Post accesable only VIA link
  6. Post will Expire on '3-OCT-2017'
  7. --------------------------
  8.  
  9.  
  10.  
  11. Q1.
  12.  
  13. Every algorithm needs a process in order to be created and utilized. Described below are the four stages of algorithm analysis and design:
  14.  
  15. Design....
  16.  
  17. The first stage is to identify the problem and thoroughly understand it. After you obtain the input, break out the problem into stages. All of this is elementary, but the same basic rules apply.
  18. This is also the point where you are going to use flowcharts and/or use pseudo code to work out the specific problems of solving the flow of operations within the code.
  19.  
  20. Analysation and Validation....
  21.  
  22. Once you have the basic framework of the algorithm it’s time to start analyzing how efficient the code is in solving the problem. Professional programmers usually prefer to examine it prior to writing the code and analyze results based on their expectations from the design stage.
  23. Either way, you're basically looking for the efficiency of the algorithm. Algorithms are measured in time and space for their efficiency. Look at the algorithm you’re designing and see how it works with different size data structures and what kind of time it takes to work through those structures.
  24.  
  25. Implementation....
  26.  
  27. Writing and coding the algorithm is the next step in the process. Write the code to execute quickly but can also handle the input data that it will receive.
  28.  
  29. Test ( Profiling and Debugging )....
  30.  
  31. Once the algorithm is designed and coded, go back and experiment with different variables in the algorithm. Experimentation in algorithmic design is really just another step of the analyzing of the algorithm. When you find flaws in what you have written or ways to write the code better, then go back to the design step and redesign the algorithm.
  32.  
  33. Circular Process of designing the algorithm....
  34.  
  35. The design and analysis of algorithms is a circular process. You may find yourself becoming involved in any one of the steps. An experiment on an existing algorithm might lead to a new design. Or a re-coding of an algorithm might lead to a more efficient execution. Wherever you find yourself, keep working towards the goal of efficiency of the algorithm.
  36.  
  37.  
  38. Q2.
  39. Bhavya, this is very basic and You're a smart girl. I'm sure You'll be able to write this yourself :)
  40.  
  41.  
  42.  
  43. Q3.
  44. Bhavya, this is very basic and You're a smart girl. I'm sure You'll be able to write this yourself :)
  45.  
  46.  
  47.  
  48. Q4.
  49.  
  50. Dictionary :-
  51.  
  52. A dictionary is a set of items with a key attached to each item. Using the key, we can access, insert or delete the item quickly. Dictionary is a major data structure. Dictionaries differ from lists in that you can access items in a dictionary by a key rather than a position. There are many ways to implement a dictionary. The thing that is most important to notice right now is that the get item and set item operations on a dictionary are O(1). Another important dictionary operation is the contains operation. Checking to see whether a key is in the dictionary or not is also O(1).
  53.  
  54. ADT :-
  55.  
  56. An abstract data type (ADT) is a mathematical model for data types where a data type is defined by its behavior (semantics) from the point of view of a user of the data, specifically in terms of possible values, possible operations on data of this type, and the behavior of these operations. This contrasts with data structures, which are concrete representations of data, and are the point of view of an implementer, not a user.
  57.  
  58. Stable Algorithm :-
  59.  
  60. Sorting stability means that records with the same key retain their relative order before and after the sort.
  61. So stability matters if, and only if, the problem you're solving requires retention of that relative order.
  62. If you don't need stability, you can use a fast, memory-sipping algorithm from a library, like heapsort or quicksort, and forget about it.
  63. If you need stability, it's more complicated. Stable algorithms have higher big-O CPU and/or memory usage than unstable algorithms.
  64.  
  65. First-Child-Next-Sibling Representation of Trees :-
  66.  
  67. Usually, tree data structures are organised in a way that each node contains pointers to all its children.
  68. In a First-Child-Next-Sibling Representation of Trees that represents a multi-way tree T, each node corresponds to a node in T and has two pointers: one to the node's first child, and one to its next sibling in T. The children of a node thus form a singly-linked list.
  69.  
  70.  
  71.  
  72. Q5.
  73.  
  74. Some Important Problem Types Include...
  75. • Sorting
  76. Sorting algorithm is an algorithm that puts elements of a list in a certain order. Example - Bubble Sort, Selection Sort, etc.
  77.  
  78. • Searching
  79. A search algorithm, broadly speaking, is an algorithm for finding an item with specified properties among a collection of items. Example - Binary search, Linear Search, etc.
  80.  
  81. • String processing
  82. In text editors, we might want to search through a very large document
  83. (say, a million characters) for the occurence of a given string (maybe dozens of characters).
  84.  
  85. • Graph problems
  86. The set of problems for digraphs and undirected graphs are different. Graphs are made up of vertices and edges. Among classic algorithms/problems on digraphs we can note the following:
  87. • Reachability. Can you get to B from A?
  88. • Shortest path (min-cost path). Find the path from B to A with the minimum cost
  89.  
  90. Example... Dijkstra's and Floyd's algorithms
  91.  
  92. • Combinatorial problems
  93. Task to find a combinatorial object-such as a permutation or a combination.
  94.  
  95. • Geometric problems
  96. Geometric algorithms deal with geometric objects such as points , lines, and polygons.
  97.  
  98. • Numerical problems
  99. these involve mathematical objects of continuous nature: solving equations and system of equation, computing definite integrals, evaluating functions and so on.
  100.  
  101.  
  102.  
  103. Q6.
  104.  
  105. Bhavya, I'll look into this question when I get back to bangalore.
  106.  
  107.  
  108.  
  109. Q7.
  110.  
  111. Order of growth in algorithm means how the time for computation increases when you increase the input size. It really matters when your input size is very large.
  112.  
  113. Order of growth provide only a crude description of the behavior of a process. For example, a process requiring n^2 steps and a process requiring 1000n^2 steps and a process requiring 3n^2 10n 17 steps all have O(n^2) order of growth. Order of growth provides a useful indication of how we may expect the behavior of the process to change as we change the size of the problem. Depending on the algorithm, the behaviour changes. So, this is one of the most important things that we have to care when we design an algorithm for some given problem.
  114.  
  115. There are different notations to measure it and the most important one is Big O notation which gives you the worst case time complexity.
  116.  
  117.  
  118.  
  119. Q8.
  120.  
  121. Bhavya, I'll look into this question when I get back to bangalore.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement