Вы находитесь на странице: 1из 10

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/well-known-fundamental-algorithms-summation-of-a-s-aspire-2015

1/10

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/well-known-fundamental-algorithms-summation-of-a-s-aspire-2015

2/10

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/well-known-fundamental-algorithms-summation-of-a-s-aspire-2015

3/10

10/9/2015

Campus Commune

Q
Course Completion Quiz

2.11. Well-known Fundamental Algorithms -Summation of a set of numbers

Often mathematical formulae require the addition of many variables, summation or sigma notation is a convenient
and simple form of shorthand used to give a concise expression for a sum of the values of a variable.
Let x1, x2, x3,....,xn denote a set of n numbers. x1 is the first number in the set. xi represents the ith number in the
set.
Using summation concept, we can make the logic work more accurate and efficient.
Problem Statement

https://campuscommune.tcs.com/communities/aspire-2015/content/well-known-fundamental-algorithms-summation-of-a-s-aspire-2015

4/10

10/9/2015

Campus Commune

Given a set of n numbers, design an algorithm that adds these numbers and returns the resultant sum. Assume
n is greater than or equal to zero.
Algorithm development
One of the most fundamental things that we are likely to do with a computer is to add a set of n numbers. When
confronted with this problem in the absence of a computer, we simply write the numbers down one under the
other and start adding up the right column. For example, consider the addition of 421, 583 and 714.
421
583
714
....8
In designing a computer algorithm to perform this task, we must take a somewhat different approach. The
computer has a built-in device which accepts two numbers to be added, performs the addition and returns the
sum of the two numbers (see Fig. 2.28). In designing an algorithm to add a set of numbers, a primary concern is
the mechanism for the addition process. We will concentrate first on this aspect of the problem before looking at
the overall design.

https://campuscommune.tcs.com/communities/aspire-2015/content/well-known-fundamental-algorithms-summation-of-a-s-aspire-2015

5/10

10/9/2015

Campus Commune

The simplest way that we can instruct the computer's arithmetic unit to add a set of numbers is to write down an
expression that specifies addition we wish to be performed. For our three numbers mentioned previously, we
could write
s := 421 + 583 + 714
(1)
The assignment operator causes the value resulting from the evaluation of the right hand side of statement (1) to
be placed in the memory cell allocated to the variables. Expression (1) will add three specific numbers as
required. Unfortunately, it is capable of doing little else. Suppose we wanted to sum three other numbers. For
this task, we would need a new program statement. It would therefore seem reasonable that all constants in
expression (1) could be replaced by variables.
We would then have
s := a + b + c
(2)
Expression (2) adds any three numbers provided they have previously assigned as values or contents a, b, c
respectively. Expression (2) as the basis of program for adding numbers is more general and more useful than
expression (1). It still has a serious deficiency - it can only add set of three numbers. A fundamental goal in
designing algorithms and implementing programs is to make the programs general enough so that they will
successfully handle a wide variety of input conditions. That is, we want a program that will add any n numbers
where n can take on a wide range of values. The approach we need to take to formulate an algorithm to add n
numbers in a computer is different from what we would do conventionally to solve the problem. Conventionally,
we could write the general equation
s = (a1 + a2 + ..... an)
(3)
or equivalently s = a
(4)
We could also write a computer program statement somewhat like equation (3) to add our n numbers but this is
not very practical because we want to change n (We may want to use the program to sum a different sized set of
numbers). We must therefore; look for a better mechanism more in keeping with the way a computer is naturally
designed to do things. Several facts about computers are relevant for our current problem.
Firstly, Computers are well suited to do repetitive things. Secondly, the computer adding device is designed so
that it can only add two numbers at a time. Therefore, ask how we can formulate an algorithm for the addition of
n numbers that makes best use of these facts.
One way to do this that takes note of the fact that the computer adds two numbers at a time is to start by adding
the first two numbers a1 and a2. That is
s := a1 + a2;
(1)
We could then proceed by adding a3 to the s computed in step (1)
s := s + a3;
(2)
In a similar manner:
s := s + a4
s := s + a5
.............
(3,.,n-1)
.............
s := s + an
From step (2) onwards, we are actually repeating the same process over and over. The only difference is that
values of a and s change with each step. For general ith step, we have
s := s + a(i+1)
(i)
This general step can be placed in a loop to iteratively generate the sum of n numbers. The algorithm we want to
https://campuscommune.tcs.com/communities/aspire-2015/content/well-known-fundamental-algorithms-summation-of-a-s-aspire-2015

6/10

10/9/2015

Campus Commune

develop for summing n numbers should perform correctly for all values of n greater than or equal to 0 (n >= 0). It
must therefore work correctly for the sum of zero (n = 0) and the sum of 1 (n = 1) numbers. This means the step
(1) we have used is not appropriate. However, we replace i + 1 in the general step (i), by i and substitute i = 1
we get:
s:= s + a 1
(1)
The step (1') will be correct provided s := 0 before this step is executed. It follows that all sums for n > 1 can be
generated iteratively. The instance where n = 0 is a special case which cannot be generated iteratively. The sum
of zero numbers is zero and so we can generate the first sum directly by the assignment
s := 0
The core of the algorithm for summing n numbers therefore involves a special step followed by a set of n iterative
steps. That is,
Compute first sum (s = 0) as special case
Build each of the n remaining sums from its predecessor by an iterative process
Write out the sum of n numbers
The only other considerations involve the input of n, the number of numbers to be summed and the input of
successive numbers with each iterative step. Our complete algorithm can be outlined.
1.
2.
3.
4.
5.
6.

Prompt and read in the number of numbers to be summed.


Initialize sum for zero numbers.
While less than n numbers have been summed repeatedly
Read in next number,
Compute current sum by adding the number read to the most recent sum.
Write out sum of n numbers.

Performance Analysis
To sum n numbers (n - 1) additions must be performed. The present algorithm has used n additions
instead to allow a simpler and cleaner implementation.
Initially, and each time through the loop, the sum s reflects the sum of the first i numbers read. On
termination (when i = n ) s will represent the sum of n numbers. Because i is incremented by 1 with each
iteration, eventually, the condition i < n will be violated and the loop will terminate.
The design employed makes no consideration of the accuracy of the resultant sum or the finite size of
numbers that can be accurately represented in the compute. An algorithm that minimizes errors in
summation does so by adding at each stage, the two smallest numbers remaining.
Observe that only general algorithms should be implemented as programs. A program parameterized to
solve just one problem is usually wasted effort.
The obvious or direct solution to the problem is considerably different to the computer solution. The
requirement of flexibility imposes this difference on the computer solution.
Consideration of the problem its lowest limit (i.e. n = 0 ) leads to a mechanism that can be extended to
larger values of n by simple repetition. This is a very common device in computer algorithm design.
A program that reads and sums n numbers is not a very useful programming tool. A much more practical
https://campuscommune.tcs.com/communities/aspire-2015/content/well-known-fundamental-algorithms-summation-of-a-s-aspire-2015

7/10

10/9/2015

Campus Commune

implementation is a function that returns the sum of an array of n numbers. That is


function asum{var a : nelements , n : integer) : real;
var sum {the partial sum},
i : integer;
begin {compute the sum of n real array elements ( n >= 0 )
sum := 0.0;
for i : = 1 to n do
sum := sum + a[ i ];
asum := sum;
end
Applications
Average calculations, variance and least square calculations.
For further reading you may refer the websites below.
http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=binarySearch
Ask a doubt

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

Open Doubts Closed Doubts

Annu Pandey
what type of questions has been asked in this submodule , moreover which topics to study to score good.
please tell
about 3 months ago
Shrikant Ekkaldevi
Only theoretical and TRUE & FALSE type questions.
Spoorthi
The last pseudocode in this chapter:
.....for i : = 1 to n do
sum := sum + a[ i ];
asum := sum;
end
Since we are using arrays, shouldn't the value of i vary from 0 to (n-1)?
about 4 months ago
https://campuscommune.tcs.com/communities/aspire-2015/content/well-known-fundamental-algorithms-summation-of-a-s-aspire-2015

8/10

10/9/2015

Campus Commune

Anjali Bhawnani
because this a pseudo code and not an actual implementation in any language.
Shubhanka Bhandari
This is just a way of representing. Pseudo code usually tries to simplify the algorithm representation,
without going into details of any programming language. That is why they are referring to 1 to n rather than
0 to n-1.
Baranidaran Manoharan Moderator
Yes, you are correct. It should be 0 to N-1

Quiz

Your Dashboard

Dhanasethupathy Balasubramaniam
3367 Miles
Current Course Progress

100

Overall Progress

100

https://campuscommune.tcs.com/communities/aspire-2015/content/well-known-fundamental-algorithms-summation-of-a-s-aspire-2015

9/10

10/9/2015

Campus Commune

About | Scoring Process | Contact Us

https://campuscommune.tcs.com/communities/aspire-2015/content/well-known-fundamental-algorithms-summation-of-a-s-aspire-2015

10/10

Вам также может понравиться