Data Structures Algorithms
Data Structures Algorithms
a) Initialize the array such that is a free list only with all pointers correctly set. List A
and List B will be empty lists.(P1.1,D3.2)
b) Display all of the entries in List B in the intended sequence of the list.(P1.1,D3.2)
c) Add a new data item (held in a filed called NEWITEM) to List A. (reminder:
Ensure that you insert the data in alphabetic sequence of characters.)(P1.1, D2.4,
D3.2)
Data Structure
The data structure is a specific way of adding and organizing data in a system. Data structures
are used in mainly every program or software system.
Data type
Primitive types
1. Boolean
2. Char
3. Float
4. Double
5. int
6. String
7. Enumerated type
1. Array
2. Record
3. Union
4. Tagged Union
5. Plain old data structure
1. Container
2. Queue
3. Set
4. Stack
5. String
6. Graph
7. Hash
8. Vector
9. Linked List
10. List Itterator.
import java.util.ArrayList;
import java.util.Collections;
arrayList.add("A");
arrayList.add("B");
arrayList.add("C");
/*
to be swapped.
*/
Collections.swap(arrayList,0,4);
/*
Output would be
*/
a) Implement this scenario using linked list data structure. Display the candidate code,
IQ score & English test marks of the candidates who have been selected for the
interview. Display the no of candidates who have received reject letters. Assume
that the no of candidates are taken at runtime.(P2.1,D2.2)
b) Exceptions should be handled appropriately throughout the implementation.
(P2.2,D2.4)
c) Prepare a test plan report for the above scenario. (P2.3,D1.2)
d)
Class Candidates
while(li.hasNext())
System.out.println(li.next());
Runtime exceptions: A runtime exception is an exception that occurs that probably could have
been avoided by the programmer. As opposed to checked exceptions, runtime exceptions are
ignored at the time of compilation.
Errors: These are not exceptions at all, but problems that arise beyond the control of the user or
the programmer. Errors are typically ignored in your code because you can rarely do anything
about an error. For instance, if a stack overflow occurs, an error will arise. They are also ignored
at the time of compilation.
Figure 2.1
For Instance:
This tactic is the basis of efficient algorithms for all sort of issues, such as sorting (e.g.,
quicksort, merge sort), multiplying large numbers (e.g. Karatsuba), syntactic analysis (e.g., top-
down parsers), and computing the discrete Fourier transform (FFTs).
On the other hand, the ability to realize and design D&C algorithms is a skill that takes time to
master. As when proving a theorem by induction, it is often necessary to replace the original
problem by a more general or complicated issue in order to initialize the recursion, and there is
no systematic method for finding the proper generalization.
These D&C complications are seen when optimizing the calculation of a Fibonacci number with
efficient double recursion.
The correctness of a divide and conquer algorithm is usually proved by mathematical induction,
and its computational cost is often determined by solving recurrence relations.
Therefore, We can roughly think of dynamic programming as an intelligent, brute force method
which enables us to go via all possible solutions to pick the best one. A dynamic programming
algorithm will look into the whole traffic report, focusing into all possible combinations of roads
you might take, and will only then tell you what route is the rapidest. Certainly, you might have
to wait for a while till the algorithm finishes.
Stated more concisely, a recursive definition is defined in terms of itself. Recursion is a computer
programming technique involving the use of a procedure, subroutine, function, or algorithm that
calls itself in a step having a termination condition so that successive repetitions are processed up
to the critical step where the condition is met at which time the rest of each repetition is
processed from the last one called to the first.
Recursion turns out to be a wonderful technique for dealing with many interesting problems.
Solutions written recursively are often simple. Recursive solutions are also often much easier to
conceive of and code than their iterative counterparts.
Factorial
Fibonacci
Many problems can be solved recursively, for instance, games of all types from simple ones like
the Towers of Hanoi problem to complex ones like chess. In games, the recursive solutions are
particularly convenient because, having solved the problem by a series of recursive call,
You want to find out how you got to the solution. By keeping track of the move chosen at any
point, the program call stack does this housekeeping for you! This is explained in more detail
later.
The problem is much more clearly solved using recursion: there are many problems where the
recursive solution is clearer, cleaner, and much more understandable. As long as the efficiency is
not the primary concern, or if the efficiencies of the various solutions are comparable, then you
should use the recursive solution.
Some problems are much easier to solve through recursion: there are some problems which do
not have an easy iterative solution. Here you should use recursion.
(a) Most of the time, query strings are used while you search any information through
Google, Unicode characters are mixed with query strings
The maximum length of a query string is 2000 characters. Entire query strings consist of at least
one field value. It is suggested to write field values in lower case. Due to searches on atom, text,
and HTML fields are case insensitive, and a query string can also consists the Boolean operators
AND, OR, and NOT, which are recognized by writing them in upper case.
A query string must take many forms. It has two main ways to construct a query: with and
without field names. A global search uses a query string that consists of only field values.
This document illustrates how to construct query strings for global and field searches, and how
the search logic works in each case.
1. Global Search
One- value queries
Multi- value queries
Boolean Operators
Stemming
Tokenization
Global Search
Global search provides the ability to surf for documents by specifying values that might appear
in any document field.
To perform a global search you will require writing a query string that consists of one or more
field values. The search algorithms recognize the type of each value and searches entire
document fields that could contain that value.
If the query string is a word (“red”) or a quoted string (“\” red rose \””), search retrieves entire
documents in an index that have:
a number field with a value equivalent to the number in the query (a number field with
the value 5 will match the query "5" and "5.0")
a text or HTML field that contains a token that matches the number as it appears in the
query (the text field "he took 5 minutes" will match the query "5" but not "5.0")
an atom field that literally matches the number as it appears in the query
If the query string is a date in yyyy-mm-dd form, search retrieves all documents that have:
a date field whose value equals that date (leading zeros in the query string are optional,
"2012-07-04" and "2012-7-4" are the same date)
a text or HTML field that contains a token that literally matches the date as it appears in
the query
an atom field that literally matches the date as it appears in the query
The above pictures show about an android application, where almost java programming language
was used to code. The above application is based on search engine results page, where I can use
this application to describe for this task.
Figure 4.2
The above screenshot describes about a similar application as shown in the previous description,
which is another example for SERP used application.
This assignment report provides the reader considerable knowledge on data structures and
algorithms in different organization. It will help understand how Data structures and algorithms
will help in organizations, the requirements to set up their own programs its advantages and
disadvantages and its effects on productivity. I believe that the documented information will be
most helpful to those people or organizations who are considering creating a program for their
organizations.
My knowledge on the subject was extremely limited before I started working on this assignment
report that you have just read. However, as I progressed past each task, the knowledge I gained
was simply immeasurable. I am confident that my knowledge on the subjects in this assignment
is much greater than it was before I started.
The section where the report was the one section that I answered fairly easily and the task on
writing the pseudo code was the section that I spent the most time on when it came to compiling
an answer. The time I spent answering the questions on the program and the languages that are
used in the development of these sites significantly helped improve my knowledge about them.
I sincerely do hope that this assignment will provide its every reader with as much knowledge as
I received when I compiled this assignment.
https://www.youtube.com/watch?v=CfSFyizmxp4
http://www.programcreek.com/2012/11/top-10-algorithms-for-coding-interview/
http://www.java2s.com/Tutorial/Java/0140__Collections/Copyingelementsoutofalistintoanarray.h
tm
https://play.google.com/store/apps/details?id=pl.droidsonroids.seoserp.paid
https://play.google.com/store/apps/details?id=com.SERPmojo