You are on page 1of 13

10/9/2015

Campus Commune

About
About Post Offer Engagement Portal
Post Offer Engagement Portal helps young talents, waiting to join TCS, acquire knowledge that is required,
through online training. This platform also helps trainees to learn at one's own pace, test the knowledge acquired
and reinforce concepts through static and interactive means.
Post Offer Engagement consists of the following applications
For IT Trainees
Aspire
Tech Lounges
Java Lounge
Dotnet Lounge
Mainframes Lounge
Unix/C++ Lounge
BIPM Lounge
Assurance Lounge
Language Lounge
Campus Commune
Aspire contains training materials/videos on the following courses covering basic IT topics and concepts along
with Introduction to TCS.
Introduction to Computer Systems
Problem Solving Techniques
Basics of Programming
Relational Data Base Management System
Know your TCS
Business Skills The Essentials
Aspire helps in identifying IT trainees for batching (joining) based on their performance. Upon batching, trainees
will be provided access to the respective Tech Lounge where they flex their muscles to learn and practice
technology related concepts and programming.
For EIS Trainees
Aspire
Tech Lounges
Java Lounge
Language Lounge
https://campuscommune.tcs.com/communities/aspire-2015/content/linked-lists-aspire-2015

1/13

10/9/2015

Campus Commune

Campus Commune
EIS Lounge contains training materials/videos on the EIS courses covering basic EIS topics and concepts.

Scoring Process
Scoring will be based on the following parameters
Academic Scores
College Accredition Score
Recruitment Score
Aspire/Tech Lounge Score
Language Lounge Score
Campus Commune Score
In case of IT trainees, weighted consolidated score of an individual will decide on his/her date of joining TCS
(batching) and the Stream. Batching will be done quarterly. Top performers will be batched and the remaining
trainees will have to compete against their peers for the next batching process and their scores will be reset.
Transparency in Performance Scores will be maintained.

Contact Us
For Queries or Assistance
Call: 1-800-209-3111 (Toll Free)
Email: ilp.support@tcs.com
Monday to Friday (8:00 AM to 8:00 PM)

About Certifications
Hello user!
As you have successfully completed the Aspire course curriculum, you can now further your learning process by
signing up for a certification course.
Certifications establish credibility by serving as a proof that you have successfully completed a rigorous online
training and also serve as a token of recognition from well-established institutes. Completing one or more
certifications will give you an additional advantage during the Initial Learning Program.
https://campuscommune.tcs.com/communities/aspire-2015/content/linked-lists-aspire-2015

2/13

10/9/2015

Campus Commune

Basic Certification
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.

Installing, Configuring, and Administering Microsoft Windows 7


Installing, Configuring, and Administering Microsoft Windows 2008 Server
Installing, Configuring, and Administering Microsoft Windows 2012 Server
Red Hat Certified Engineer (RHCE) Certification
Red Hat Certified Virtualization Administrator (RHCVA) Certification
Cisco Certified Network Associate (CCNA) Certification
ITIL 2011 Foundation
Installing, Configuring, and Administering Microsoft SQL Server 2008
Installing, Configuring, and Administering Microsoft SQL Server 2012
Microsoft Certified Technology Specialist (MCTS): Microsoft Exchange Server 2010, Configuration
Certification
11. MCTS: Administering and Deploying System Center 2012 Configuration Manager Certification

Leaderboards

Close

List of Badges

Close Genius

Intellect
Guru
Awarded about 5 months
Aspire
2015
ago.

Awarded about 5 months


ago.

Earn this!

Problem Solving

LogoutPre-ILP Home

1.Logic and Problem solving

Q
2.Algorithms

Q
3.Basic Data Structures
https://campuscommune.tcs.com/communities/aspire-2015/content/linked-lists-aspire-2015

3/13

10/9/2015

Campus Commune

Q
Course Completion Quiz

3.3. Linked Lists


Search for a node in the linearly ordered linked list
Problem Statement
Design and implement an algorithm to search a linear ordered linked list for a given alphabetic key or name.
Algorithm development
With the stack and queue data structures it is always clear in advance exactly where the current item should be
retrieved from or inserted. This favourable situation does not prevail when it is necessary to perform insertion and
deletions on linear linked lists. Before we can carry out such operations with an ordered linked list we must first
carry out a search of the list to establish the position where the change must be made. It is this problem that we
wish to consider in the present discussion. We will need such a search algorithm later when we come to discuss
linked list insertion and deletion operations. Before starting on the algorithm design let us consider an example
that defines the problem we wish to solve. Suppose we have a long alphabetically ordered list of names as
shown in Figure : 3.7 and that we wish to insert the name DAVID.

The task that must be performed before the insertion can be made is to locate exactly where DAVID should be
inserted. After examining the names list above we quickly respond that DAVID needs to be inserted between
DANIEL and DROVER. At this point, we will not concern ourselves with how the insertion (or deletion) is
made but rather we will concentrate on developing the accompanying search algorithm for a linked list structure.
In deciding where DAVID should be inserted, what we have to do is search the list until we have either found a
name that comes alphabetically later (in the insertion case) or until we have found a matching name (in the
deletion case). On the assumption that the list is ordered, there will be no need to search further in either case.
The central part of our search algorithm will therefore be:
1. While current search name comes alphabetically after current list name do,
(a) Move to next name in the list.
This algorithm does not take into account that the search name may come after the last name in the list and as
https://campuscommune.tcs.com/communities/aspire-2015/content/linked-lists-aspire-2015

4/13

10/9/2015

Campus Commune

such it is potentially infinite, we will need to take this into account later. Our development so far has been
straightforward and the problem would be almost solved if we only had to search a linear list rather than a linked
linear list. The motivation for maintaining an ordered set of names as a linked list arises because it allows for
efficient insertion and deletion of names while still retaining the alphabetical order. As we will see later this is
certainly not true for a list of names stored as a linear array. At this point, we are ready to consider the linked list
representation of an ordered list and the accompanying search algorithm.
In the linked list data structure each record or name has an appended pointer field that points to the locate-on the
next record in logical (usually alphabetical) order in the list. From this definition we can see that there no longer
has to be a direct correspondence between the way the names are arranged physically and their logical order. It
is this relaxation of the relationship between physical and logical order that makes it possible to do efficient
insertions and deletions. The difference is illustrated below in Figure : 3.8

In conducting a search of a linked list we must follow the logical order rather than the physical order. The search
of an ordered list like the one we have just described must begin at first list element in logical order. If all list
nodes have the structure,
listnode = record
listname : nameformat;
next: listpointer
end
then we will need to use the linkage information to proceed along the list (i.e. if the search cannot be terminated
at the first element). This will simply amount to assigning the pointer value next in the current node to the current
node pointer, i.e.
current:=next
If we step through the logical order of the list in this manner we will eventually arrive at the desired position
https://campuscommune.tcs.com/communities/aspire-2015/content/linked-lists-aspire-2015

5/13

10/9/2015

Campus Commune

corresponding to the place where the search name either exists or is able to be inserted. Assuming the search has
terminated we must now ask what information must be passed back to the calling procedure to allow an
amendment to the list or to indicate whether the name is present or not? A Boolean variable not found which is
set to true when the search procedure is called and which may subsequently be set to false, can be used to
terminate the search. In our search, at the time of termination, we will have a pointer to the current node (as
shown in Figure : 3.9 and 3.10). i.e.,

In both situations, the pointer to the current node is actually the information stored in the "DANIEL" node. To
make either an insertion or a deletion the pointer information stored in the "DANIEL" node is going to have to be
changed (i.e.in the insertion case DANIEL's pointer would have to point to the DAVID node rather than the
DROVER node). Our search mechanism should therefore always keep around the pointer to the previous node
which can be returned to the calling procedure when the search terminates. This can be done (assuming the
statement issued) using the following steps at each node before moving on to the next node:
previous:=current;
current:=next;
The only other consideration that must be made relates to the termination problem that we had mentioned earlier.
Our search mechanism should be able to handle the case where the name we are searching for is alphabetically
beyond the end of the list (e.g. the last name in the list might be WILSON and the search name ZELMAN).
Since the last name in the list has no successor its pointer points to "nowhere". This situation is signalled by setting
the pointer field to nil(as shown in Fig: 3.11). If WILSON were the last name in the list we would have:

https://campuscommune.tcs.com/communities/aspire-2015/content/linked-lists-aspire-2015

6/13

10/9/2015

Campus Commune

The search loop should therefore terminate either on reaching the search name's position (virtual or real) or on
encountering a nil pointer. A special pointer to the start of the listhead will need to be supplied to the search
procedure. To accommodate the case where the search name occurs before the first name in the list the pointer
to the previous node will need to be initialized to nil. Our algorithm can now be detailed.
Algorithm description
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.

Establish search name, and the pointer to the start of the list.
Initialize previous node pointer to nil and set flag for continuing the search to true and current pointer to
start of list.
While search can logically proceed and not at end of list do,
If search name is alphabetically less than current list name then,
(a.1) set condition for terminating search.
else
(a'.1) set previous node pointer to current node pointer,
(a'.2) adjust current node pointer so that it points to next node.
Establish whether or not search name found.
Return previous and current node pointers and found status.

Performance Analysis
The cost of the ordered list search is proportional to the number of nodes that have to be examined before the
search terminates. Over a large number of trials, if the search has equal probability of stopping at each node, then
on average half the list will need to be searched. In the worst case all nodes will have to be examined.
Applications
1. Maintaining short linked lists.
For further reading you may refer to the below links
http://webserver.ignou.ac.in/virtualcampus/adit/course/cst103/block3/unit2/cst103-bl3-u2-06.htm
http://www.ee.ryerson.ca/~courses/coe428/sorting/mergesort.html
http://algorithms.openmymind.net/search/linear.html
http://www.sparknotes.com/cs/searching/linearsearch/section1.rhtml

Related Videos
https://campuscommune.tcs.com/communities/aspire-2015/content/linked-lists-aspire-2015

7/13

10/9/2015

Campus Commune

Ask a doubt

(Misuse of 'Ask a Doubt' Section will be dealt as per the Terms & Conditions of Campus Commune)

Open Doubts Closed Doubts

Lakshmi Vemulakonda
Read this link for scoring better
https://docs.google.com/document/d/1jS__hfPRMdKqla4es8mfpnvkhetkTIULBgaLedI4euU/edit?pli=1
about 11 hours ago
Hariharan Raju
Linked List can be sorted by?
a) by swapping only data
b) by swapping only addresses
c)both a and b
d)none
Anyone plz tell the answer....
about 19 hours ago
Thabshira Shamsudheen
https://campuscommune.tcs.com/communities/aspire-2015/content/linked-lists-aspire-2015

8/13

10/9/2015

Campus Commune

c. both a and b

Medha Arora
Is it necessary to sort a list before searching a particular element?
a. If less work is involved in searching an element than to sort and then extract and then we go for sort.
b.If frequent use of the list is required for the purpose of retrieving specific element,it is more efficient to
sort the list.
c.Thus depends on situation
d.all of the above
What is the answer?
about 23 days ago
Prashant Zande
d.all the above
Prashant Zande
d.all the above
Harshitha Jampani
http://www.studytonight.com/data-structures/stack-data-structure
heck this really helpful
about 27 days ago
Ashita Saxena
guys please tell either it is 1 or 2 or none of the above for smallest divisor of even integer as lot of miles
r deducting for even the answer is right.
about 1 month ago
Harshitha Jampani
better leave that question at least we can save 2 miles from deduction
https://campuscommune.tcs.com/communities/aspire-2015/content/linked-lists-aspire-2015

9/13

10/9/2015

Campus Commune

Shikhar Sharma
Smallest divisor of an even integer is the negative of that integer.
For eg. smallest divisor of 6 is -6 as integer includes the negative values also.So it is neither 1 nor 2.
See the options and answer carefully if you encounter this question again. Good Luck !
Balamareeswaran Murugesan
1) Is linked lists Linear or non linear? or both
2) Is circular linked lists linear or non linear ?
3) for searching a node in double linked lists running time complexity in average case is?
a) n b) n log n c) n log2n d) none of these

about 1 month ago


Shri N
According to access strategies linked list is a linear one,
According to storage linked nist is a non-linear one.
Shri N
http://www.studytonight.com/data-structures/introduction-to-linked-list
Nishaben Barai
3) n log 2n Not sure
Nishaben Barai
3) n log 2n Not sure
Tantia Bandopadhyay
Where shall I find amaterials on Circular linked lists? Its not in video even!!!!
about 1 month ago
Sivakumar Burle
https://campuscommune.tcs.com/communities/aspire-2015/content/linked-lists-aspire-2015

10/13

10/9/2015

Campus Commune

go to studytonight.com
Sujeet Angadi
Q1) each node in singly linked lists has ___ fileds? options are 2,3,1,4 which one is ryt ?
Q2) linked lists are physically arranged in non linear is it ryt ?
Q3) To access a certain node in a singly linked lists options were 1)takes one step 2) takes two step
3)requires dat all its precedecessors to be visited 4) requires its successors to be visited

about 1 month ago


Rohit Manglani
A1) 2.
A2) Logically linked list is a linear data structure because each node has a link to its next one but
physically it is not necessarily true because memory allocation to nodes may or may not be sequential.
A3) 3)requires dat all its precedecessors to be visited.
Mohammed Mahadik
Which of the following statements(s) are regarding circular linked list ?
i. We can traverse the list backward
ii. If a pointer to a node is given we cannot delete the node
Only 1.
Only 2
Both 1 and 2
None
about 1 month ago
Aziz Shaikh
Both 1 & 2
Harish Rodd
https://campuscommune.tcs.com/communities/aspire-2015/content/linked-lists-aspire-2015

11/13

10/9/2015

Campus Commune

ITS BOTH 1 AND 2


Moumita Saha
what is the running time complexity of a linearly linked list to search in average case?
a>N^2(log n) b>N^2(n) c>N^2(1) d>None
this concept is not so clear to me.neone plz?
about 1 month ago
Previous 1 2 3 Next

Quiz

Your Dashboard

Dhanasethupathy Balasubramaniam
3367 Miles
Current Course Progress

100

Overall Progress

100

About | Scoring Process | Contact Us


https://campuscommune.tcs.com/communities/aspire-2015/content/linked-lists-aspire-2015

12/13

10/9/2015

Campus Commune

https://campuscommune.tcs.com/communities/aspire-2015/content/linked-lists-aspire-2015

13/13

You might also like