Career Options after 12th Science and Commerce:
· Careers in Advertising
· Careers in Fire Engineering
· Careers in Music
· Careers in Aeronautical / Aerospace Engineering
· Careers in Air Force (As Officer)
· Careers in Forensic Science
· Careers in Nursing
· Careers in Forestry Wildlife
· Careers in Nutrition and Dietetics
· Careers in Airhostess/Pursers
· Careers in Genetic Engineering
· Careers in Oceanography
· Careers in Ayurveda
· Careers in Gemmology
· Careers in Occupational Therapy
· Careers in Bio-Technology
· Careers in Hotel industry
· Careers in Pharmacy
· Careers in Call Centres
· Careers in Indian Army
· Careers in Photography
· Careers in Chartered Accountancy
· Careers in Interior Designing
· Careers in Physiotherapy
· Careers in Civil Engineering
· Careers in ICWAI
· Careers in Psychiatry
· Careers in Journalism/Mass Communication
· Careers in Psychology
· Careers in Commercial Pilot
· Careers in Law
· Careers in Public Relation
· Careers in Company Secretary
· Careers in Librarianship
· Careers in Teaching
· Careers in Tea Management
· Careers in Dance
· Careers in Mechanical Engineering
· Careers in Dairy
· Careers in Medical Transcription
· Careers in Travel and Tourism
· Careers in Dentistry
· Careers in Medical Lab Technology
· Careers in Veterinary Science
· Careers in Electronic Engineering
· Careers in Medicine
· Careers in Video Jockey
· Careers in Fashion Technology
· Careers in Merchant Navy
· Careers in Film Making
· Career in Modeling
Search This Blog
Thursday, April 29, 2010
COMMON INTERVIEW QUESTIONS AND ANSWERS
1. Tell me about yourself:
The most often asked question in interviews. You need to have a short statement prepared
in your mind. Be careful that it does not sound rehearsed. Limit it to work-related items
unless instructed otherwise. Talk about things you have done and jobs you have held that
relate to the position you are interviewing for. Start with the item farthest back and work up
to the present.
2. Why did you leave your last job?
Stay positive regardless of the circumstances. Never refer to a major problem with
management and never speak ill of supervisors, co-workers or the organization. If you do,
you will be the one looking bad. Keep smiling and talk about leaving for a positive reason
such as an opportunity, a chance to do something special or other forward-looking reasons.
3. What experience do you have in this field?
Speak about specifics that relate to the position you are applying for. If you do not have
specific experience, get as close as you can.
4. Do you consider yourself successful?
You should always answer yes and briefly explain why. A good explanation is that you have
set goals, and you have met some and are on track to achieve the others.
5. What do co-workers say about you?
Be prepared with a quote or two from co-workers. Either a specific statement or a
paraphrase will work. Jill Clark, a co-worker at Smith Company, always said I was the
hardest workers she had ever known. It is as powerful as Jill having said it at the interview
herself.
6. What do you know about this organization?
This question is one reason to do some research on the organization before the interview.
Find out where they have been and where they are going. What are the current issues and
who are the major players?
7. What have you done to improve your knowledge in the last year?
Try to include improvement activities that relate to the job. A wide variety of activities can
be mentioned as positive self-improvement. Have some good ones handy to mention.
8. Are you applying for other jobs?
Be honest but do not spend a lot of time in this area. Keep the focus on this job and what
you can do for this organization. Anything else is a distraction.
9. Why do you want to work for this organization?
This may take some thought and certainly, should be based on the research you have done
on the organization. Sincerity is extremely important here and will easily be sensed. Relate
it to your long-term career goals.
10. Do you know anyone who works for us?
Be aware of the policy on relatives working for the organization. This can affect your answer
even though they asked about friends not relatives. Be careful to mention a friend only if
they are well thought of.
11. What kind of salary do you need?
A loaded question. A nasty little game that you will probably lose if you answer first. So, do
not answer it. Instead, say something like, That's a tough question. Can you tell me the
range for this position? In most cases, the interviewer, taken off guard, will tell you. If not,
say that it can depend on the details of the job. Then give a wide range.
12. Are you a team player?
You are, of course, a team player. Be sure to have examples ready. Specifics that show you
often perform for the good of the team rather than for yourself are good evidence of your
team attitude. Do not brag, just say it in a matter-of-fact tone. This is a key point.
13. How long would you expect to work for us if hired?
Specifics here are not good. Something like this should work: I'd like it to be a long time. Or
As long as we both feel I'm doing a good job.
14. Have you ever had to fire anyone? How did you feel about that?
This is serious. Do not make light of it or in any way seem like you like to fire people. At the
same time, you will do it when it is the right thing to do. When it comes to the organization
versus the individual who has created a harmful situation, you will protect the organization.
Remember firing is not the same as layoff or reduction in force.
15. What is your philosophy towards work?
The interviewer is not looking for a long or flowery dissertation here. Do you have strong
feelings that the job gets done? Yes. That's the type of answer that works best here. Short
and positive, showing a benefit to the organization.
16. If you had enough money to retire right now, would you?
Answer yes if you would. But since you need to work, this is the type of work you prefer. Do
not say yes if you do not mean it.
17. Have you ever been asked to leave a position?
If you have not, say no. If you have, be honest, brief and avoid saying negative things
about the people or organization involved.
18. Explain how you would be an asset to this organization
You should be anxious for this question. It gives you a chance to highlight your best points
as they relate to the position being discussed. Give a little advance thought to this
relationship.
19. Why should we hire you?
Point out how your assets meet what the organization needs. Do not mention any other
candidates to make a comparison.
20. Tell me about a suggestion you have made
Have a good one ready. Be sure and use a suggestion that was accepted and was then
considered successful. One related to the type of work applied for is a real plus.
21. What irritates you about co-workers?
This is a trap question. Think real hard but fail to come up with anything that irritates you.
A short statement that you seem to get along with folks is great.
22. What is your greatest strength?
Numerous answers are good, just stay positive. A few good examples:
Your ability to prioritize, Your problem-solving skills, Your ability to work under pressure,
Your ability to focus on projects, Your professional expertise, Your leadership skills, Your
positive attitude .
23. Tell me about your dream job.
Stay away from a specific job. You cannot win. If you say the job you are contending for is
it, you strain credibility. If you say another job is it, you plant the suspicion that you will be
dissatisfied with this position if hired. The best is to stay genetic and say something like: A
job where I love the work, like the people, can contribute and can't wait to get to work.
24. Why do you think you would do well at this job?
Give several reasons and include skills, experience and interest.
25. What are you looking for in a job?
See answer # 23
26. What kind of person would you refuse to work with?
Do not be trivial. It would take disloyalty to the organization, violence or lawbreaking to get
you to object. Minor objections will label you as a whiner.
27. What is more important to you: the money or the work?
Money is always important, but the work is the most important. There is no better answer.
28. What would your previous supervisor say your strongest point is?
There are numerous good possibilities:
Loyalty, Energy, Positive attitude, Leadership, Team player, Expertise, Initiative, Patience,
Hard work, Creativity, Problem solver
29. Tell me about a problem you had with a supervisor
Biggest trap of all. This is a test to see if you will speak ill of your boss. If you fall for it and
tell about a problem with a former boss, you may well below the interview right there. Stay
positive and develop a poor memory about any trouble with a supervisor.
30. What has disappointed you about a job?
Don't get trivial or negative. Safe areas are few but can include:
Not enough of a challenge. You were laid off in a reduction Company did not win a contract,
which would have given you more responsibility.
31. Tell me about your ability to work under pressure.
You may say that you thrive under certain types of pressure. Give an example that relates
to the type of position applied for.
32. Do your skills match this job or another job more closely?
Probably this one. Do not give fuel to the suspicion that you may want another job more
than this one.
33. What motivates you to do your best on the job?
This is a personal trait that only you can say, but good examples are:
Challenge, Achievement, Recognition
34. Are you willing to work overtime? Nights? Weekends?
This is up to you. Be totally honest.
35. How would you know you were successful on this job?
Several ways are good measures:
You set high standards for yourself and meet them. Your outcomes are a success.Your boss
tell you that you are successful
36. Would you be willing to relocate if required?
You should be clear on this with your family prior to the interview if you think there is a
chance it may come up. Do not say yes just to get the job if the real answer is no. This can
create a lot of problems later on in your career. Be honest at this point and save yourself
future grief.
37. Are you willing to put the interests of the organization ahead of your own?
This is a straight loyalty and dedication question. Do not worry about the deep ethical and
philosophical implications. Just say yes.
38. Describe your management style.
Try to avoid labels. Some of the more common labels, like progressive, salesman or
consensus, can have several meanings or descriptions depending on which management
expert you listen to. The situational style is safe, because it says you will manage according
to the situation, instead of one size fits all.
39. What have you learned from mistakes on the job?
Here you have to come up with something or you strain credibility. Make it small, well
intentioned mistake with a positive lesson learned. An example would be working too far
ahead of colleagues on a project and thus throwing coordination off.
40. Do you have any blind spots?
Trick question. If you know about blind spots, they are no longer blind spots. Do not reveal
any personal areas of concern here. Let them do their own discovery on your bad points. Do
not hand it to them.
41. If you were hiring a person for this job, what would you look for?
Be careful to mention traits that are needed and that you have.
42. Do you think you are overqualified for this position?
Regardless of your qualifications, state that you are very well qualified for the position.
50 Common Interview Questions and Answers
© JobsAssist.com (www.jobsassist.com ) and VyomWorld.com (www.vyomworld.com ) – Free Student Resources
43. How do you propose to compensate for your lack of experience?
First, if you have experience that the interviewer does not know about, bring that up: Then,
point out (if true) that you are a hard working quick learner.
44. What qualities do you look for in a boss?
Be generic and positive. Safe qualities are knowledgeable, a sense of humor, fair, loyal to
subordinates and holder of high standards. All bosses think they have these traits.
45. Tell me about a time when you helped resolve a dispute between others.
Pick a specific incident. Concentrate on your problem solving technique and not the dispute
you settled.
46. What position do you prefer on a team working on a project?
Be honest. If you are comfortable in different roles, point that out.
47. Describe your work ethic.
Emphasize benefits to the organization. Things like, determination to get the job done and
work hard but enjoy your work are good.
48. What has been your biggest professional disappointment?
Be sure that you refer to something that was beyond your control. Show acceptance and no
negative feelings.
49. Tell me about the most fun you have had on the job.
Talk about having fun by accomplishing something for the organization.
50. Do you have any questions for me?
Always have some questions prepared. Questions prepared where you will be an asset to
the organization are good. How soon will I be able to be productive? and What type of
projects will I be able to assist on? are examples.
The most often asked question in interviews. You need to have a short statement prepared
in your mind. Be careful that it does not sound rehearsed. Limit it to work-related items
unless instructed otherwise. Talk about things you have done and jobs you have held that
relate to the position you are interviewing for. Start with the item farthest back and work up
to the present.
2. Why did you leave your last job?
Stay positive regardless of the circumstances. Never refer to a major problem with
management and never speak ill of supervisors, co-workers or the organization. If you do,
you will be the one looking bad. Keep smiling and talk about leaving for a positive reason
such as an opportunity, a chance to do something special or other forward-looking reasons.
3. What experience do you have in this field?
Speak about specifics that relate to the position you are applying for. If you do not have
specific experience, get as close as you can.
4. Do you consider yourself successful?
You should always answer yes and briefly explain why. A good explanation is that you have
set goals, and you have met some and are on track to achieve the others.
5. What do co-workers say about you?
Be prepared with a quote or two from co-workers. Either a specific statement or a
paraphrase will work. Jill Clark, a co-worker at Smith Company, always said I was the
hardest workers she had ever known. It is as powerful as Jill having said it at the interview
herself.
6. What do you know about this organization?
This question is one reason to do some research on the organization before the interview.
Find out where they have been and where they are going. What are the current issues and
who are the major players?
7. What have you done to improve your knowledge in the last year?
Try to include improvement activities that relate to the job. A wide variety of activities can
be mentioned as positive self-improvement. Have some good ones handy to mention.
8. Are you applying for other jobs?
Be honest but do not spend a lot of time in this area. Keep the focus on this job and what
you can do for this organization. Anything else is a distraction.
9. Why do you want to work for this organization?
This may take some thought and certainly, should be based on the research you have done
on the organization. Sincerity is extremely important here and will easily be sensed. Relate
it to your long-term career goals.
10. Do you know anyone who works for us?
Be aware of the policy on relatives working for the organization. This can affect your answer
even though they asked about friends not relatives. Be careful to mention a friend only if
they are well thought of.
11. What kind of salary do you need?
A loaded question. A nasty little game that you will probably lose if you answer first. So, do
not answer it. Instead, say something like, That's a tough question. Can you tell me the
range for this position? In most cases, the interviewer, taken off guard, will tell you. If not,
say that it can depend on the details of the job. Then give a wide range.
12. Are you a team player?
You are, of course, a team player. Be sure to have examples ready. Specifics that show you
often perform for the good of the team rather than for yourself are good evidence of your
team attitude. Do not brag, just say it in a matter-of-fact tone. This is a key point.
13. How long would you expect to work for us if hired?
Specifics here are not good. Something like this should work: I'd like it to be a long time. Or
As long as we both feel I'm doing a good job.
14. Have you ever had to fire anyone? How did you feel about that?
This is serious. Do not make light of it or in any way seem like you like to fire people. At the
same time, you will do it when it is the right thing to do. When it comes to the organization
versus the individual who has created a harmful situation, you will protect the organization.
Remember firing is not the same as layoff or reduction in force.
15. What is your philosophy towards work?
The interviewer is not looking for a long or flowery dissertation here. Do you have strong
feelings that the job gets done? Yes. That's the type of answer that works best here. Short
and positive, showing a benefit to the organization.
16. If you had enough money to retire right now, would you?
Answer yes if you would. But since you need to work, this is the type of work you prefer. Do
not say yes if you do not mean it.
17. Have you ever been asked to leave a position?
If you have not, say no. If you have, be honest, brief and avoid saying negative things
about the people or organization involved.
18. Explain how you would be an asset to this organization
You should be anxious for this question. It gives you a chance to highlight your best points
as they relate to the position being discussed. Give a little advance thought to this
relationship.
19. Why should we hire you?
Point out how your assets meet what the organization needs. Do not mention any other
candidates to make a comparison.
20. Tell me about a suggestion you have made
Have a good one ready. Be sure and use a suggestion that was accepted and was then
considered successful. One related to the type of work applied for is a real plus.
21. What irritates you about co-workers?
This is a trap question. Think real hard but fail to come up with anything that irritates you.
A short statement that you seem to get along with folks is great.
22. What is your greatest strength?
Numerous answers are good, just stay positive. A few good examples:
Your ability to prioritize, Your problem-solving skills, Your ability to work under pressure,
Your ability to focus on projects, Your professional expertise, Your leadership skills, Your
positive attitude .
23. Tell me about your dream job.
Stay away from a specific job. You cannot win. If you say the job you are contending for is
it, you strain credibility. If you say another job is it, you plant the suspicion that you will be
dissatisfied with this position if hired. The best is to stay genetic and say something like: A
job where I love the work, like the people, can contribute and can't wait to get to work.
24. Why do you think you would do well at this job?
Give several reasons and include skills, experience and interest.
25. What are you looking for in a job?
See answer # 23
26. What kind of person would you refuse to work with?
Do not be trivial. It would take disloyalty to the organization, violence or lawbreaking to get
you to object. Minor objections will label you as a whiner.
27. What is more important to you: the money or the work?
Money is always important, but the work is the most important. There is no better answer.
28. What would your previous supervisor say your strongest point is?
There are numerous good possibilities:
Loyalty, Energy, Positive attitude, Leadership, Team player, Expertise, Initiative, Patience,
Hard work, Creativity, Problem solver
29. Tell me about a problem you had with a supervisor
Biggest trap of all. This is a test to see if you will speak ill of your boss. If you fall for it and
tell about a problem with a former boss, you may well below the interview right there. Stay
positive and develop a poor memory about any trouble with a supervisor.
30. What has disappointed you about a job?
Don't get trivial or negative. Safe areas are few but can include:
Not enough of a challenge. You were laid off in a reduction Company did not win a contract,
which would have given you more responsibility.
31. Tell me about your ability to work under pressure.
You may say that you thrive under certain types of pressure. Give an example that relates
to the type of position applied for.
32. Do your skills match this job or another job more closely?
Probably this one. Do not give fuel to the suspicion that you may want another job more
than this one.
33. What motivates you to do your best on the job?
This is a personal trait that only you can say, but good examples are:
Challenge, Achievement, Recognition
34. Are you willing to work overtime? Nights? Weekends?
This is up to you. Be totally honest.
35. How would you know you were successful on this job?
Several ways are good measures:
You set high standards for yourself and meet them. Your outcomes are a success.Your boss
tell you that you are successful
36. Would you be willing to relocate if required?
You should be clear on this with your family prior to the interview if you think there is a
chance it may come up. Do not say yes just to get the job if the real answer is no. This can
create a lot of problems later on in your career. Be honest at this point and save yourself
future grief.
37. Are you willing to put the interests of the organization ahead of your own?
This is a straight loyalty and dedication question. Do not worry about the deep ethical and
philosophical implications. Just say yes.
38. Describe your management style.
Try to avoid labels. Some of the more common labels, like progressive, salesman or
consensus, can have several meanings or descriptions depending on which management
expert you listen to. The situational style is safe, because it says you will manage according
to the situation, instead of one size fits all.
39. What have you learned from mistakes on the job?
Here you have to come up with something or you strain credibility. Make it small, well
intentioned mistake with a positive lesson learned. An example would be working too far
ahead of colleagues on a project and thus throwing coordination off.
40. Do you have any blind spots?
Trick question. If you know about blind spots, they are no longer blind spots. Do not reveal
any personal areas of concern here. Let them do their own discovery on your bad points. Do
not hand it to them.
41. If you were hiring a person for this job, what would you look for?
Be careful to mention traits that are needed and that you have.
42. Do you think you are overqualified for this position?
Regardless of your qualifications, state that you are very well qualified for the position.
50 Common Interview Questions and Answers
© JobsAssist.com (www.jobsassist.com ) and VyomWorld.com (www.vyomworld.com ) – Free Student Resources
43. How do you propose to compensate for your lack of experience?
First, if you have experience that the interviewer does not know about, bring that up: Then,
point out (if true) that you are a hard working quick learner.
44. What qualities do you look for in a boss?
Be generic and positive. Safe qualities are knowledgeable, a sense of humor, fair, loyal to
subordinates and holder of high standards. All bosses think they have these traits.
45. Tell me about a time when you helped resolve a dispute between others.
Pick a specific incident. Concentrate on your problem solving technique and not the dispute
you settled.
46. What position do you prefer on a team working on a project?
Be honest. If you are comfortable in different roles, point that out.
47. Describe your work ethic.
Emphasize benefits to the organization. Things like, determination to get the job done and
work hard but enjoy your work are good.
48. What has been your biggest professional disappointment?
Be sure that you refer to something that was beyond your control. Show acceptance and no
negative feelings.
49. Tell me about the most fun you have had on the job.
Talk about having fun by accomplishing something for the organization.
50. Do you have any questions for me?
Always have some questions prepared. Questions prepared where you will be an asset to
the organization are good. How soon will I be able to be productive? and What type of
projects will I be able to assist on? are examples.
Algorithm Complexity
Algorithm Complexity
Written and composed by Laurent Haan
http://www.progressive-coding.com
Introduction to Algorithm Complexity
[...] an algorithm is a procedure (a finite set of well-defined
instructions) for accomplishing some task which, given an initial state,
will terminate in a defined end-state. The computational complexity and
efficient implementation of the algorithm are important in computing,
and this depends on suitable data structures.
Wikipedia: http://en.wikipedia.org/wiki/Algorithm
In Computer Science, it is important to measure the quality of algorithms, especially the
specific amount of a certain resource an algorithm needs. Examples of such resources
would be time or memory storage. Nowadays, memory storage is almost a non-essential
factor when designing algorithms but be aware that several systems still have memory
constraints, such as Digital Signal Processors in embedded systems.
Different algorithms may complete the same task with a different set of instructions in
less or more time, space or effort than other. The analysis and study of algorithms is a
discipline in Computer Science which has a strong mathematical background. It often
relies on theoretical analysis of pseudo-code.
To compare the efficiency of algorithms, we don't rely on abstract measures such as the
time difference in running speed, since it too heavily relies on the processor power and
other tasks running in parallel. The most common way of qualifying an algorithm is the
Asymptotic Notation, also called Big O.
Asymptotic Notation
The symbol O is used to describe an asymptotic upper bound for the magnitude of a
function in terms of another, simpler function.
This means that for x > k, when x tends to infinity, the value f(x) will always be inferior
to C *g(x) (with C a constant).
The idea behind this notation is that it allows us to qualify to efficiency of an algorithm by
telling us how often a certain algorithm will execute operations before terminating. Let's
start with a simple example:
void f ( int a[], int n )
{
int i;
printf ( "N = %d\n", n );
for ( i = 0; i < i =" 0;" i =" 0;" mid =" (" n =" mid;"> x )
i = mid + 1;
else
return mid;
}
return 0;
}
We can call this an O(N) algorithm and not be wrong because the time complexity will
never exceed O(N). But because the array is split in half each time, the number of steps
is always going to be equal to the base-2 logarithm of N, which is considerably less than
O(N). So an even better choice would be to set the upper bound to log N, which is the
upper limit that we know we're guaranteed never to cross. Therefore, a more accurate
claim is that binary search is a logarithmic, or O(log2 N), algorithm.
Bubble Sort
A sorting algorithm is an algorithm that puts elements of a list in a certain order. The
most used orders are numerical or lexicographical order. There exist numerous sort
algorithms and there efficiency vary greatly!
Bubble sort is a straightforward and simplistic method of sorting data that is used in
computer science education. The algorithm starts at the beginning of the data set. It
compares the first two elements, and if the first is greater than the second, it swaps
them. It continues doing this for each pair of adjacent elements to the end of the data
set. It then starts again with the first two elements, repeating until no swaps have
occurred on the last pass. Although simple, this algorithm is highly inefficient and is
rarely used except in education. For sorting small numbers of data (e.g. 20) it is better
than Quicksort.
void bubbleSort(int *array, int size)
{
int swapped = 0;
int x;
do
{
swapped = 0;
for (x = 0; x <>array[x+1])
{
swap(&array[x], &array[x+1]);
swapped = 1;
}
}
} while (swapped);
}
1. What is the worst case performance ?
2. What is the best case performance ?
3. Can you think of a way to improve the performance ?
Selection Sort
Selection sort is a simple sorting algorithm that improves on the performance of bubble
sort. It works by first finding the smallest element using a linear search and swapping it
into the first position in the list, then finding the second smallest element by scanning
the remaining elements, and so on. Selection sort is unique compared to almost any
other algorithm in that its running time is not affected by the prior ordering of the list, it
performs the same number of operations because of its simple structure.
void selectionSort(int *array, int size)
{
int x,y,min;
for (x = 0; x < min =" x;" y="x+1;" if="">< min =" y;" x =" 0;">= 0 && array[pos] > value)
{
array[pos+1] = array[pos];
pos--;
}
array[pos+1] = value;
}
1. What is the worst case performance ?
2. What is the best case performance ?
3. Can you think of a way to improve the performance ?
Heap Sort
Heapsort is a much more efficient version of Selection Sort. It also works by determining
the largest (or smallest) element of the list, placing that at the end (or beginning) of the
list, then continuing with the rest of the list, but accomplishes this task efficiently by
using a data structure called a heap, a special type of binary tree. Once the data list has
been made into a heap, the root node is guaranteed to be the largest element. It is
removed and placed at the end of the list, then the heap is rearranged so the largest
element remaining moves to the root . Using the heap, finding the next largest element
takes O(log n) time, instead of O(n) for a linear scan as in simple selection sort. This
allows Heapsort to run in O(n log n) time.
Merge Sort
Merge sort takes advantage of the ease of merging already sorted lists into a new sorted
list. It starts by dividing the list into two sublists which are then sorted again with Merge
Sort. This continues until the size of the list equals one (which is sorted). Then it merges
those sublists again into bigger lists and only a few simple steps are required to merge
two sorted lists.
function mergesort(m, start, end)
if length(m) ≤ 1
return m
else
middle = start+end / 2
left = mergesort(m, start, middle)
right = mergesort(m, middle,end)
result = merge(left, right)
return result
Since Merge Sort is a recursive implementation working on two independent sublists, it
can be efficiently implemented in parallel using threads. The speed gain of a parallel
execution is doubled on dual core processors.
Quick Sort
Quicksort is a divide and conquer algorithm, which relies on a partition operation: to
partition an array, we choose an element, called a pivot, move all smaller elements
before the pivot, and move all greater elements after it. This can be done efficiently in
linear time and in-place. We then recursively sort the lesser and greater sublists. Efficient
implementations of quicksort (with in-place partitioning) are somewhat complex, but are
among the fastest sorting algorithms in practice. Together with its modest O(log n) space
usage, this makes quicksort one of the most popular sorting algorithms, available in
many standard libraries. The most complex issue in quicksort is choosing a good pivot
element; consistently poor choices of pivots can result in drastically slower (O(n2))
performance, but if at each step we choose the median as the pivot then it works in O(n
log n).
Exercise: Stone Age boulders
Two stone age men have gathered an impressive collection of boulders in their cave, all
of different size and weight, standing neatly one after the other, in the order they have
been collected. To restore some order in the room, they want to arrange the boulders
from the smallest to the largest, with the smallest at the entrance of the cave and the
largest close to the back wall.
Each boulder is only represented by its weight, so the heavier it is, the largest it is (we
assume that they are all made of the same material). As there are only 2 stone age men,
and the space inside the cave is limited, they are only allowed to swap two boulders at a
time. Additionally, to save their energy, they want to use a method that allows them to
move the minimum necessary weight only.
Write an algorithm that takes an array of boulders and orders it from the smallest to the
largest, by only swapping two boulders at a time but with the least effort in terms of kilos
moved.
Example:
{5, 3, 1}
-> {1, 3, 5} and necessary effort: 1+5 = 6
{6, 4, 1, 2}
-> {6, 1, 4, 2}, effort 5
-> {6, 2, 4, 1}, effort 3
-> {1, 2, 4, 6}, effort 7
total effort: 15
Written and composed by Laurent Haan
http://www.progressive-coding.com
Introduction to Algorithm Complexity
[...] an algorithm is a procedure (a finite set of well-defined
instructions) for accomplishing some task which, given an initial state,
will terminate in a defined end-state. The computational complexity and
efficient implementation of the algorithm are important in computing,
and this depends on suitable data structures.
Wikipedia: http://en.wikipedia.org/wiki/Algorithm
In Computer Science, it is important to measure the quality of algorithms, especially the
specific amount of a certain resource an algorithm needs. Examples of such resources
would be time or memory storage. Nowadays, memory storage is almost a non-essential
factor when designing algorithms but be aware that several systems still have memory
constraints, such as Digital Signal Processors in embedded systems.
Different algorithms may complete the same task with a different set of instructions in
less or more time, space or effort than other. The analysis and study of algorithms is a
discipline in Computer Science which has a strong mathematical background. It often
relies on theoretical analysis of pseudo-code.
To compare the efficiency of algorithms, we don't rely on abstract measures such as the
time difference in running speed, since it too heavily relies on the processor power and
other tasks running in parallel. The most common way of qualifying an algorithm is the
Asymptotic Notation, also called Big O.
Asymptotic Notation
The symbol O is used to describe an asymptotic upper bound for the magnitude of a
function in terms of another, simpler function.
This means that for x > k, when x tends to infinity, the value f(x) will always be inferior
to C *g(x) (with C a constant).
The idea behind this notation is that it allows us to qualify to efficiency of an algorithm by
telling us how often a certain algorithm will execute operations before terminating. Let's
start with a simple example:
void f ( int a[], int n )
{
int i;
printf ( "N = %d\n", n );
for ( i = 0; i < i =" 0;" i =" 0;" mid =" (" n =" mid;"> x )
i = mid + 1;
else
return mid;
}
return 0;
}
We can call this an O(N) algorithm and not be wrong because the time complexity will
never exceed O(N). But because the array is split in half each time, the number of steps
is always going to be equal to the base-2 logarithm of N, which is considerably less than
O(N). So an even better choice would be to set the upper bound to log N, which is the
upper limit that we know we're guaranteed never to cross. Therefore, a more accurate
claim is that binary search is a logarithmic, or O(log2 N), algorithm.
Bubble Sort
A sorting algorithm is an algorithm that puts elements of a list in a certain order. The
most used orders are numerical or lexicographical order. There exist numerous sort
algorithms and there efficiency vary greatly!
Bubble sort is a straightforward and simplistic method of sorting data that is used in
computer science education. The algorithm starts at the beginning of the data set. It
compares the first two elements, and if the first is greater than the second, it swaps
them. It continues doing this for each pair of adjacent elements to the end of the data
set. It then starts again with the first two elements, repeating until no swaps have
occurred on the last pass. Although simple, this algorithm is highly inefficient and is
rarely used except in education. For sorting small numbers of data (e.g. 20) it is better
than Quicksort.
void bubbleSort(int *array, int size)
{
int swapped = 0;
int x;
do
{
swapped = 0;
for (x = 0; x <>array[x+1])
{
swap(&array[x], &array[x+1]);
swapped = 1;
}
}
} while (swapped);
}
1. What is the worst case performance ?
2. What is the best case performance ?
3. Can you think of a way to improve the performance ?
Selection Sort
Selection sort is a simple sorting algorithm that improves on the performance of bubble
sort. It works by first finding the smallest element using a linear search and swapping it
into the first position in the list, then finding the second smallest element by scanning
the remaining elements, and so on. Selection sort is unique compared to almost any
other algorithm in that its running time is not affected by the prior ordering of the list, it
performs the same number of operations because of its simple structure.
void selectionSort(int *array, int size)
{
int x,y,min;
for (x = 0; x < min =" x;" y="x+1;" if="">< min =" y;" x =" 0;">= 0 && array[pos] > value)
{
array[pos+1] = array[pos];
pos--;
}
array[pos+1] = value;
}
1. What is the worst case performance ?
2. What is the best case performance ?
3. Can you think of a way to improve the performance ?
Heap Sort
Heapsort is a much more efficient version of Selection Sort. It also works by determining
the largest (or smallest) element of the list, placing that at the end (or beginning) of the
list, then continuing with the rest of the list, but accomplishes this task efficiently by
using a data structure called a heap, a special type of binary tree. Once the data list has
been made into a heap, the root node is guaranteed to be the largest element. It is
removed and placed at the end of the list, then the heap is rearranged so the largest
element remaining moves to the root . Using the heap, finding the next largest element
takes O(log n) time, instead of O(n) for a linear scan as in simple selection sort. This
allows Heapsort to run in O(n log n) time.
Merge Sort
Merge sort takes advantage of the ease of merging already sorted lists into a new sorted
list. It starts by dividing the list into two sublists which are then sorted again with Merge
Sort. This continues until the size of the list equals one (which is sorted). Then it merges
those sublists again into bigger lists and only a few simple steps are required to merge
two sorted lists.
function mergesort(m, start, end)
if length(m) ≤ 1
return m
else
middle = start+end / 2
left = mergesort(m, start, middle)
right = mergesort(m, middle,end)
result = merge(left, right)
return result
Since Merge Sort is a recursive implementation working on two independent sublists, it
can be efficiently implemented in parallel using threads. The speed gain of a parallel
execution is doubled on dual core processors.
Quick Sort
Quicksort is a divide and conquer algorithm, which relies on a partition operation: to
partition an array, we choose an element, called a pivot, move all smaller elements
before the pivot, and move all greater elements after it. This can be done efficiently in
linear time and in-place. We then recursively sort the lesser and greater sublists. Efficient
implementations of quicksort (with in-place partitioning) are somewhat complex, but are
among the fastest sorting algorithms in practice. Together with its modest O(log n) space
usage, this makes quicksort one of the most popular sorting algorithms, available in
many standard libraries. The most complex issue in quicksort is choosing a good pivot
element; consistently poor choices of pivots can result in drastically slower (O(n2))
performance, but if at each step we choose the median as the pivot then it works in O(n
log n).
Exercise: Stone Age boulders
Two stone age men have gathered an impressive collection of boulders in their cave, all
of different size and weight, standing neatly one after the other, in the order they have
been collected. To restore some order in the room, they want to arrange the boulders
from the smallest to the largest, with the smallest at the entrance of the cave and the
largest close to the back wall.
Each boulder is only represented by its weight, so the heavier it is, the largest it is (we
assume that they are all made of the same material). As there are only 2 stone age men,
and the space inside the cave is limited, they are only allowed to swap two boulders at a
time. Additionally, to save their energy, they want to use a method that allows them to
move the minimum necessary weight only.
Write an algorithm that takes an array of boulders and orders it from the smallest to the
largest, by only swapping two boulders at a time but with the least effort in terms of kilos
moved.
Example:
{5, 3, 1}
-> {1, 3, 5} and necessary effort: 1+5 = 6
{6, 4, 1, 2}
-> {6, 1, 4, 2}, effort 5
-> {6, 2, 4, 1}, effort 3
-> {1, 2, 4, 6}, effort 7
total effort: 15
LISTS OF FIRST IN INDIA
Architecture
- First Islamic Mausoleum (tomb) in India: Sultan Ghari, built in 1231 CE for Prince Nasir ud din Mahmud, eldest son of Iltumish.
- First true dome, Alai Darwaza, Qutb complex, Delhi, built in 1311 CE, by first Khilji Sultan of Delhi, Ala-ud-din Khilji.
- First true arch, Balban's tomb, Mehrauli Archeological Park, Delhi, built in ca 1287 CE, by Ghiyas ud din Balban of Mamluk dynasty.
- First garden-tomb on the Indian subcontinent, also the first with Persian double-dome: Humayun's Tomb, Delhi, built 1562-1571 CE
Awards and Titles
- Miss World: Reita Faria in 1966
- Miss Universe: Sushmita Sen in 1994
- Dhan Gopal Mukerji, first Indian to win any literary award (the Newbery Medal) in the United States, in 1927 for Gay Neck, the Story of a Pigeon
- Nirad C. Chaudhuri, first Indian to win a major non-fiction award, the Duff Cooper Prize in the United Kingdom, in 1966 for The Continent of Circe
- Salman Rushdie won the Booker Prize for Midnight's Children in 1981
- Bharat Ratna: Dr. Sarvepalli Radhakrishnan, C. Rajagopalachari, and Dr C.V. Raman in 1954
- Commandeur of the Order of Arts and Letters: Mrinal Sen[1]
- Chevalier of the Order of Arts and Letters: Sivaji Ganesan
- Dadasaheb Phalke Award: Devika Rani in 1969
- Ashoka Chakra Award to a civilian : D.K. Jatar (posthumous) and M.C Dixit, captain and co-captain respectively, of the sabotaged plane Kashmir Princess, for "most conspicuous bravery, daring and self-sacrifice"
- Magsaysay Award: Vinoba Bhave, 1958
- Oscar for Lifetime Achievement - Satyajit Ray
- Ford Supermodel of the World (contest): Bipasha Basu, 1996[citation needed] [2]
Nobel Prize
- Nobel Prize winner: Rabindranath Tagore for the Nobel Prize in Literature, 1913. He was also the first Asian to get the prize.
- Nobel Prize in Physics: C. V. Raman in 1930.
- Nobel Prize in Medicine: Har Gobind Khorana in 1968. (India born US citizen)
- Nobel Peace Prize: Mother Teresa in 1979 (Albania born Indian citizen)
- Nobel Prize in Economics: Amartya Sen in 1998
- Nobel Prize in Chemistry: Venkatraman Ramakrishnan in 2009 (US citizen)
- [[Nobel Prize in Economics}}1st woman to win - Elinor ostrom (2009)
Defence
- Commander-in-Chief of Free India: General Sir Roy Bucher
- Indian Commander-in-Chief of Free India: General Kodandera Madappa Cariappa, 1949
- Chief of Air Staff: Air Marshal Sir Thomas Elmhirst
- Indian Chief of Staff: General Kodandera Madappa Cariappa, 1947
- Commander-in-Chief, IAF: Air Marshal Subroto Mukerjee, 1954
- Chief of Naval Staff: Vice Admiral R D Katari
- Cosmonaut: Sqn Ldr Rakesh Sharma, 1984
- Field Marshal: Sam Manekshaw, 1973.
Exploration
- Person to reach the South Pole: Col Jatinder Kumar Bajaj
- Woman to scale Mount Everest: Bachendri Pal on May 23, 1984. She was the 5th woman in the world to scale the peak.
- Sound film: Alam Ara directed by Ardeshir Irani[3], 1931, First Talkie actress:Zubeida
- Oscar winner: Bhanu Athaiya for Best Costume Design for Gandhi (film) in 1982
- Oscar nomination for Best Foreign Language Film: Mother India in 1957
- Music director to win an Oscar and first double Oscar winner-Mr. A. R. Rahman for Slumdog Millionaire, 22 February 2009.
- Sound engineer to win an Oscar: Resul Pookutty for Slumdog Millionaire, 22 February 2009
- Palme d'Or at 1946 Cannes Film Festival:Neecha Nagar directed by Chetan Anand
- National Film Award for cinema: Shyamchi Aai in 1954
- Colorized film: Mughal-e-Azam in 2004 (the original black-and-white version was released in 1960)
- Sponsored TV serial: Hum Log, started on July 7, 1984, was also the first soap opera of India, ran for 156 episodes
- Guinness Book of World Records in the category Fewest actors in a narrative film: Yaadein (1964) directed and acted by Sunil Dutt [4]
- Actor to enact 10 roles: Kamal Haasan
- 3D film: My Dear Kuttichathan, a Malayalam film, produced in 1984, dubbed in Hindi as Chhota Chetan.
- 70 mm film: Padayottam, a Malayalam film, produced in 1982
- Ordre des Arts et des Lettres (officer of the order of arts and letters): Director: Mrinal Sen (1985); Actor:Sivaji Ganesan (1995); Actress: Aishwarya Rai Bachchan(2009)
- Hindi film to be screened at the United Nations: Lage Raho Munna Bhai on 10 November 2006
Governance
- President: Rajendra Prasad (1950-1962)
- Vice-President: S. Radhakrishnan
- Prime Minister: Jawaharlal Nehru (1947-1964). The first term lasted till 1952 after which he was re-elected
- Deputy Prime Minister: Vallabhbhai Patel (1947-1950)
- Prime Minister to be voted out of office: Indira Gandhi (1977) when the Indian National Congress lost to the Janata Party
- Non-Congress government: by Janata Party with Morarji Desai as the Prime Minister (1977-1980)
- Non-Congress State government with Majority by Single Party : C.N.Annadurai of DMK, TamilNadu 1967
- Prime Minister to lead a minority government for a full term (five years): P. V. Narasimha Rao, June 21, 1991 – May 16, 1996
- Person outside the Nehru-Gandhi family to serve as Prime Minister for a full term (five years): P. V. Narasimha Rao, June 21, 1991 – May 16, 1996
- Prime Minister from South India: P. V. Narasimha Rao, 1991
- Governor-General: Warren Hastings
- Governor General of Independent India: Lord Mountbatten, 1947
- Indian Governor-General of Indian Union: C Rajagopalachari, 1948
- Chief Justice of India: H. J. Kania (1947-1951)
1st woman speaker of lok sabha-- shanno devi
- Indian ICS Officer: Satyendranath Tagore, 1863
- Speaker of Lok Sabha: G.V. Mavlankar (1952-1956)
- Finance Minister of Independent India: R.K. Shanmukhan Chetty (1947-1949), for others see First Indian Cabinet
- Presentation of First Budget after India's Independence : R.K. Shanmukhan Chetty on Nov 26, 1947
- First Home Minister of India: Sardar Vallabh Bhai Patel[5]
- First Indian Chief Minister to die in Office: C.N.Annadurai, TamilNadu
- First Indian President to die in Office: Dr Zakir Hussain, 3 May 1969
- First Indian Prime Minister to resign from office: Morarji Desai, 1979
- First Woman Cabinet Minister in India: Rajkumari Amrit Kaur
- First Woman Minister in India: Vijaya Lakshmi Pandit
- First Woman Chief Minister: Sucheta Kriplani Sucheta Kriplani
- First Female Home Minister: Sabitha Indra Reddy Sabitha Indra Reddy
- youngest ever chief minister-- prafulla Kumar,assam at the age of 32
Science
- Hydroelectric plant: On the Gaganachukki waterfall of the Sivasamudram Falls, Karnataka. Built in 1902.
- City to have electricity: Bangalore, in 1906 (it was in fact the first city in Asia to have electricity)
- Man in space: Rakesh Sharma aboard Salyut 7, on April 3, 1984. He was the 138th man in space worldwide.
- Woman in space: Kalpana Chawla aboard Space Shuttle Columbia flight STS-87, on November 19, 1997. She was a naturalized United States citizen, and represented the US during the event.
- Test-tube baby: Durga Agarwal, born 1978
- Scientific Expedition to Antarctica: 1981
- Nuclear Reactor: CIRUS, Mumbai, Maharashtra
- First Genetically Modified Food Product in India : Bt. Egg plant Hybrid (Bt. -- Bacilius thuringiensis)
- Satellite : Aryabhatta, launched on April 19, 1975
- Satellite dedicated exclusively for educational services : EDUSET
- Successfully indigenous launch vehicle : SLV-3
- Prospective space tourist: Santhosh George Kulangara, proposed in 2009 aboard Virgin Galactic
Sport
- Person to swim across the English Channel: Mihir Sen, 1958
- Woman to swim across the English Channel: Arati Saha, 1959
- Formula One race driver: Narain Karthikeyan
- Formula One team: Force India F1
- A1 GP race victory: Narain Karthikeyan, Zhuhai, China, 2007
- Person to equal world record in Archery: Limba Ram, 1992
Olympics
- Olympic team medal: Gold for Hockey at the 1928 Summer Olympics Amsterdam, beating the Netherlands.
- Olympic individual medal (in British India): Silver by Norman Pritchard for 200 metres races at the 1900 Summer Olympics, Paris. (This is disputed however. The IOC claims he participated for India. The IAAF records him as participant for Great Britain.)
- Olympic individual medal: Bronze by K. D. Jadhav for wrestling at the 1952 Summer Olympics Helsinki.
- Olympic individual medal by a woman: Bronze by Karnam Malleswari for weightlifting 54 kg class, at the 2000 Summer Olympics Sydney.
- Olympic silver medal: Rajyavardhan Singh Rathore for Men's Double Trap at the 2004 Summer OlympicsAthens.
- Olympic individual gold medal: Abhinav Bindra for 10 m Air Rifle at the 2008 Summer Olympics Beijing.
- Olympic medal in Boxing: Vijender Kumar at the 2008 Summer Olympics Beijing.
Chess
- Chess Grandmaster : Male - Vishwanathan Anand, 1988.
Female - Koneru Humpy - 2002 - She was also the youngest woman to become a grandmaster at 15 years old.
Tennis
- Grand Slam title: Mahesh Bhupathi (partnering with Japanese Rika Hiraki) in the Mixed Doubles category of the 1997 French Open.
- Woman to win a match in a Grand Slam event: Nirupama Vaidyanathan beat Italian Gloria Pizzichini in the first round of the 1998 Australian Open
- Woman to reach 4th round (highest as of 2009) of a Grand Slam singles event: Sania Mirza in the Singles category of the 2005 US Open.
- Woman to win a Grand Slam title: Sania Mirza (partnering with Mahesh Bhupathi) in the Mixed Doubles category of the 2009 Australian Open.
- Grand Slam junior title: Leander Paes in the Singles category of the 1990 Wimbledon Championship.
- Grand Slam junior title by a woman: Sania Mirza (partnering with Russian Alisa Kleybanova) in the Doubles category of the 2003 Wimbledon Championships.
Cricket
- Cricket tournament: The Bombay Triangular (1905-1911) which later became the Bombay Quadrangular (1912-1936)
- Cricket test match: Against England at Lord's, June 25, 1932
- First One day Cricket captain: (S.Venkataraghavan)
- First Test Cricket captain: C. K. Nayudu for the 1932 tour of England
- First Indian to score ODI century was (Kapil Dev)
- Cricketer to score a century: Lala Amarnath 118 against England in December 1933 at Bombay Gymkhana grounds
- Cricketer to score a double century: Polly Umrigar, 223 against New Zealand at Hyderabad in 1955-56
- Cricketer to score a triple century: Virender Sehwag, 309 against Pakistan in Multan in 2004.
- ODI cricket hat-trick: Chetan Sharma in Reliance World Cup against New Zealand in 1987.
- Test cricket hat-trick: Harbhajan Singh against Australia in March 2001
- Cricket World Cup championship win: At the 1983 Cricket World Cup, England beating West Indies.
- Batsman to complete 10,000 runs in Test cricket: Sunil Gavaskar (he was first in the world to achieve this feat)
- Batsman to complete 10,000 runs in ODI cricket: Sachin Tendulkar (he was first in the world to achieve this feat)
- Cricket Twenty20 world cup winner: India in 2007.
- Cricketer to score 90 centuries in Test and ODIs combined: Sachin Tendulkar
- First bowler to take all 10 wickets in an innings: Anil Kumble
- First batsman to score double century in one day International : Sachin Tendulkar
Women
- Graduates: Kadambini Ganguly and Chandramukhi Basu, 1883
- Head of an Undergraduate Academic Institution: Chandramukhi Basu, 1888
- Honours Graduate: Kamini Roy (1886)
- Lawyer: Cornelia Sorabjee (1892)
- Doctorate of Science: Asima Chatterjee (1944)
- Chief Justice of a High Court (Himachal Pradesh): Leila Seth, 1991
- Supreme Court judge: Kumari Fathima Beevi
- High Court Judge : Anna Chandy
- Physician: Kadambini Ganguly, 1886
- Airline Pilot: Durba Banerjee
- In space: Kalpana Chawla aboard Space Shuttle Columbia flight STS-87, on November 19, 1997. She was a naturalized United States citizen, and represented the US during the event.
- Nobel Prize winner: Mother Teresa in 1979 (Albanian born Indian citizen)
Sport
- Asian Games gold medal winner: Kamlijit Sandhu
- To swim across the English Channel: Arati Saha, 1959
- The first Indian woman to climb Mount Everest : Bachendri Pal , 1984
- Chess Grandmaster: Koneru Humpy, 2002. She was also the youngest woman in the world to become a grandmaster at 15 years old.
- To win 1st round match in a Grand Slam event: Nirupama Vaidyanathan beat Italian Gloria Pizzichini in the first round of the 1998 Australian Open
- To reach 4th round (highest as of 2008) of a Grand Slam event: Sania Mirza in the Singles category of the 2005 US Open.
- Grand Slam junior title: Sania Mirza (partnering with Russian Alisa Kleybanova) in the Doubles category of the 2003 Wimbledon Championships.
Administration and Politics
- First female monarch of Delhi Sultanate: Razia Sultan (1205-1240) of in 1236 Mamluk dynasty
- Prime Minister: Indira Gandhi, 1966
- Minister in a government: Rajkumari Amrit Kaur in the Ministry of Health
- Chief Minister of a State: Sucheta Kripalani, Chief Minister of Uttar Pradesh, 1963-1967
- Governor: Sarojini Naidu, Governor of Uttar Pradesh, 1947-1949
- Central Minister (in pre-independent India): Vijayalakshmi Pandit, minister of local self-government and public health, 1937
- Speaker of the Lok Sabha: Meira Kumar
- Indian National Congress President: Annie Besant
- President: Pratibha Patil, 2007
- IPS Officer: Kiran Bedi
Places
- City to have electricity: Bangalore, in 1906 (it was in fact the first city in Asia to have electricity)
- District to achieve 100% literacy rate: Ernakulam district, Kerala , 1990
- City/town to achieve 100% literacy rate: Kottayam, Kerala, 1989
- District to achieve 100% literacy rate and lowest population growth rate: Pathanamthitta district, Kerala
- District to be polio-free: Pathanamthitta district, Kerala
- District to achieve tobacco free: Kottayam district, Kerala, 27 September 2008
- City to have an e-court: Ahmedabad, 8 February 2009
Transport
- First Passenger Train: between Mumbai and Thane on 16th April 1853
- First suburban railway line: Mumbai Suburban Railway in 1857
- First rapid transit (Metro) rail: Kolkata Metro in 1984
- First expressway: Mumbai-Pune Expressway in 2000
Others
- Wax statue of a living Indian: Mahatma Gandhi at Madame Tussaud's in 1939
- Newspaper : Hickey's Bengal Gazette in 1779
- Exclusive internet magazine: Bharat Samachar[citation needed]
- Miss India to participate in Miss Universe: Indrani Rahman in the Miss Universe 1952 Pageant at Long Beach, California
- President of the Indian National Congress: W C Bonnerjee, 1885
Subscribe to:
Posts (Atom)