You are not logged in. Please login at to post your questions!


EXPCODE1 - Editorial





PROBLEM:Being a programmer, Chef like arrays lot. On Chef' birthday,Chef friends given him an array "a" consists of n distinct integers. Unfortunately, the size of array "a" is too small. Chef want a bigger array!,Chef friends agree to give him an bigger array. but only if Chef is able to answer the following questions correctly: 1-Largest element in array a 2-Kth largest element Help him for getting bigger Array!

EXPLANATION:First We need Largest Element in the Array,so we have to Sort the Array,you can use any sorting technique(bubble sort,quick sort,etc) because there is no issue of Constraints and then print the largest element in array a[ n-1 ],Then answer for 2nd Question is print a[n-k],because we know the kth largest element is at position n-k


begin BubbleSort(list)

for all elements of list

  if list[i] greater list[i+1]
     swap(list[i], list[i+1])
  end if
  end for

return list
end BubbleSort




asked 15 Mar '17, 13:17

vivek96's gravatar image

accept rate: 7%

edited 20 Mar '17, 12:33

admin's gravatar image

0★admin ♦♦

Hey dear, please try to fix the following-

1 . Both the links, problem and author, lead to your profile. Also, you are not "author" of problem, but "editorialist". Its best to follow usual convention to avoid unnecessary hassle. (I know that by author you meant author of editorial , but still.)

2 . Its a beginner problem, and I am sure that beginners would appreciate if you can shed some more light on sorting techniques. Because its unfair that we expect beginners to already know advanced sorting techniques like quick sort, merge sort etc. What I want to convey is that, editorial should have something/some concept for people to learn, apart from the solution. If you can include details of one of the sorting techniques, the editorial would get a lot attractive to beginners.

3 . Stray link in line "array--a[n-1],Then answer for 2nd Question " (last line of explanation). Fix it by adding a space between square brackets and n-1.

4 . An analysis of time complexity is generally expected in editorials. See if you can do something about it :)


answered 15 Mar '17, 13:57

vijju123's gravatar image

4★vijju123 ♦♦
accept rate: 18%

edited 15 Mar '17, 13:59

done,thanks for ur suggestions,pls upvote the question if u like

(15 Mar '17, 14:13) vivek961★
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 15 Mar '17, 13:17

question was seen: 393 times

last updated: 20 Mar '17, 12:33