I have been asked tocreate a report for all collaboratingpartners on how ADTs can be utilized to improve software design, development and testingand how to specify abstract data types an
INTRODUCTION
In this report, I work as in-house software developer for BKC Software Company, a software company providing network provisioning solutions My company is part of a collaborative service provisioning development project and your company has won the contract to design and develop a "Optimum Cargo Ship Routing (OASR)" solution.
My account manager has assigned me a special role that is to inform my team about designing and implementing abstract data types I have been asked tocreate a report for all collaborating partners on how ADTs can be utilized to improve software design, development and testing and how to specify abstract data types and algorithms in a formal notation, how to evaluate the effectiveness of data structuresand algorithms.
THEORETICAL BASIS
Data Structure and Algorithm
A data structure is a specialized format for organizing, processing, retrieving, and storing data. There are several basic and advanced types of data structures, each designed to organize data for a specific purpose Data structures make it easier for users to access and manipulate the data they need Most importantly, data structures frame the organization of information so that it can be better understood by machines and humans.
The importance of Data Structure.
In computer science, the importance of data structures is ubiquitous Data structures provide the basics for solving problems Its meaning can be understood as follows.
1) The software consists of her two parts: front-end and back-end The front end provides the interface and the back end is called the database containing customer records There can be millions or trillions of customers When you need to find records for a particular customer or many customers, you do so using search methods, which are operations on data structures.
2) When the software is executed, it is first inserted into the computer's memory Jobs are queued in computer memory A queue is also a data structure concept.
3) As you know, a queue is formed when jobs and processes are entered These queues may contain too many jobs or processes In the queue, jobs are processed in the order they are entered When a job is created, it is placed at the end of the queue Assuming you need to add or remove jobs in any order, the queue concept fails and the linked list concept is used.
4) When storing data hierarchically, the concept of a tree is used.
5) If the data is ordered alphabetically or numerically, it is done by the sorting operation, which is an operation on the data structure.
Types of Data Structure and Example.
Arrays store a collection of elements in contiguous locations Elements of the same type are stored together so that the position of each element can be calculated or easily retrieved via index Array lengths can be fixed or flexible.
A stack is a collection of data items following the last-in, first-out (LIFO) rule New items added to the stack are above all previously added items Only the top element of the stack can be removed Stacks are ideal for retrieving recently used objects or data in the order they were entered.
A queue is a collection of data items that follow a first-in, first-out (FIFO) rule Unlike stacks, queues place new items at the end of all previously added items The first item in the queue is always removed first.
A linked list stores a collection of items in linear order Each item or node in a linked list contains a data item and a reference or link to the next item in the list.
A tree stores a collection of items in an abstract, hierarchical fashion Each node has a key value associated with it, and parent nodes are linked to child nodes (subnodes) There is a root node that is the ancestor of all nodes in the tree.
Figure 5 Binary Search Tree Example.
A graph is a non-linear data structure consisting of vertices (or nodes) and edges It consists of a finite set of vertices and a set of edges connecting pairs of vertices Graphs are used to solve the most demanding and complex programming problems There are various terms such as path, degree, adjacent vertices, connected components.
An algorithm is defined as a step-by-step procedure or method for solving a problem by a computer in a finite number of steps The algorithm definition procedure can branch or repeat depending on the problem for which the algorithm is being developed When defining an algorithm, the steps are written in a human-readable language and are programming language independent It can be implemented in any programming language.
Algorithms are important for understanding the relationship between how data is processed and how computers interpret it Algorithms help optimize code, including the advantageous use of mathematical techniques, making software more efficient.
As the complexity of computer algorithms increases, so does data usage, which can impact application performance and introduce several problem areas.
High-speed processing is necessary to process very large amounts of data, but when the amount of data processed increases, the necessary processing speed may not be obtained.
Retrieving a specific record from a database should be done quickly with optimal use of resources.
To handle concurrent requests from multiple users
The sorting algorithm is the algorithm that is used for arranging data in an efficient and useful manner Bubble sort, insertion sort, merge sort, etc are the example of the Sorting algorithm.
The searching algorithm is the algorithms that are used for the searching desired key in particular sorted dataset Binary search is one of the examples of Searching algorithms.
Hashing algorithms are the same as Searching but with an indexing and key ID component It provides an efficient and superior result because it assigns a key to certain data.
A recursive algorithm is an algorithm in which we set a base value as the first condition and then write other code that executes again and again until the base condition satisfies.
Dynamic programming used to convert larger, complex problems into a series of smaller problems So, it means a dynamic programming algorithm remembers the past result and use it to find the new result And with the help of this, it can break bigger problems into smaller subproblems.
A backtracking algorithm is a way to solve a problem in an additional way It uses the recursive approach, or we can say that the recursive algorithm to explain and understand the problem.
So, in simple terms, we can say that Backtracking is a systematic and additional way of trying different sequences of decisions for searching a solution until we found a one that works.
Design Specification
What is Specification and Description Language?
Specification Description Language (SDL) is a modeling language for describing real-time systems The SDL diagram shows the modeling process for specifications and description languages It can be widely used in systems in the automotive, aerospace, communications, medical and telecommunication industries.
System - The overall design is called the system and anything outside the system is called the environment There is no specific graphical representation of the system, but a block representation is available if desired.
Agents – Agents are items in the System Tree There are two types of agents: blocks and processes The system is the outermost block.
Block A block is a structuring element that does not imply any physical implementation on the target.
A block can be further decomposed in blocks and so on allowing to handle large systems.
A block symbol is a solid rectangle with its name in it
Process A process is basically the code that will be executed It is a finite state machine based task and has an implicit message queue to receive messages It is possible to have several instances of the same process running independently The number of instances present when the system starts and the maximum number of instances are declared between parentheses after the name of the process.
The full syntax in the process symbol is:
[(, )]
If omitted default values are 1 for the number of instances at startup and infinite for the maximum number of instances.
Error handling
What is Error handling testing?
Error handling testing is a type of software testing performed to test the system's ability to handle software errors and exceptions at run time These tests are done with the help of developers and testers Your error handling technique should include handling both error and exception scenarios.
Objective of Error handling testing:
To check the system ability to handle errors.
To check system highest soak point.
To do sure errors can be handles properly by the system in the future.
To do system capable of execution handling also.
Advantages of error handling tests:
Useful for building software with error handling.
This ensures that the software is always ready for any situation.
Develop exception handling techniques in software.
Disadvantages of error handling tests:
Not budget friendly as it involves both development and test teams
The effort of testing is high.
The effectiveness of data structures and algorithms
There are two things to keep in mind when thinking about algorithms First analysis of the algorithm and second design algorithm Before designing an algorithm, we need to analyze the algorithm Algorithmic analysis is the theoretical study of computer program performance and resource utilization Speed of algorithms and other resources such as memory and communications When developing software, developers should pay attention to characteristics such as usability, correctness, simplicity, functionality, modularity, software robustness, and security Feature gathering can be more important than performance But performance measures the line between doable and impossible Another reason to study performance is speed In short, performance is scale For real-time requirements, software with a large number of tasks or users is unsuitable and unfeasible if it consumes a lot of time and memory space.
The performance of an algorithm can be analyzed based on following principles:
Correctness: Correctness of an algorithm helps in producing correct result
Simplicity: Simplicity of an algorithm helps in verifying the correctness of an algorithm It helps in writing and modifying program easily
Optimality: Optimality helps in finding the best possible way to solve given problems. Readability: Readability makes the code readable
Asymptotic analysis of an algorithm refers to defining mathematical bounds on its run-time performance Asymptotic analysis can be used to extrapolate best-case, average-case, and worst-case scenarios for an algorithm very well.
Following are the commonly used asymptotic notations to calculate the running time complexity of an algorithm. Ο Notation Ω Notation θ Notation
The notation Ο(n) is the formal way to express the upper bound of an algorithm's running time It measures the worst case time complexity or the longest amount of time an algorithm can possibly take to complete.
For example, for a function f(n) Ο(f(n)) = { g(n) : there exists c > 0 and n0 such that f(n) ≤ c.g(n) for all n > n0 }
Compare the performance of two sorting algorithms
0.434 seconds Max: 0.464 seconds Table 2 Compare performance of Bubble Sort and Selection Sort Algorithm.
There are two main measures for the efficiency of an algorithm The complexity of an algorithm is divided into two types:
The space complexity of an algorithm describes the amount of memory required during the program execution as the function input Generally, the space needed. Space required by an algorithm equals the sum of the following two components.
A fixed part independent of the particular problem includes instruction space, space for constants, simple variables, and fixed-size structure variables.
A variable part includes structured variables whose size depends on the problem being solved, dynamically 2000.
Space complexity S(a) of any algorithm a is S(a) = c + v(i), where c is the fixed part, and v(i) is the variable part of the algorithm, which depends on an instance characteristic i.
The total time needed to complete the execution of an algorithm is called time complexity. The time complexity depends on all factors that the space complexity depends on Time requirements can be defined as the numerical function T(num), where T(num) can be measured as the number of steps, provided each step consumes the constant time.
Time and Space Trade Off:
It is a way of solving a problem or calculation in less time by using more storage space (or memory), or by solving a problem in very little space by spending a long time
It is a case where an algorithm or program trades increased space usage with decreased time. Here, space refers to the data storage consumed in performing a given task (RAM, HDD, etc), and time refers to the time consumed in performing a given task (computation time or response time)
Types of Time and Space Trade Off:
Re-rendering and stored images
Smaller code and loop unrolling
More time, less space Less time, more space
2 printf(“\n enter values of a,b and c ”);
Table 3 Example code of more time, less space and less time, more space.