טוב השאלה היא כזאת.נתון מערך דו מימדי NXN לא ממוין.
כאשר נניח שבשורה i האיבר המינימלי ממוקם ב (i,j) אז בשורה ה i+1 האיבר המינמלי ממוקם ב (i+1,k) כאשר k<=j צריך אלגוריתם למצוא את המספרים המינמלים בכול שורה בזמן ריצה של
o(nlogn)
Let M be a matrix with n rows and n columns with the following property: if the minimal
value in row i is located at M(i,j), then the minimal value in row i+1 is located at
M(i+1,k), where k <= j. Design an algorithm with running time O(n·logn) that finds the
minimal value for every row in M.
תודה מראש.
