create new tag
view all tags

LeetCode Exercise 4

Moodle Link

Majority Element - Divide and Conquer

Majority Element: A majority element in an array A[] of size n is an element that appears more than n/2 times (and hence there is at most one such element).


[4,3,4,5,4,2,3,4,7,5,4,4,5,4,4,4,5,6,4,4] => Solution 4

[3] => solution 3

[6,6,6,6,6,6,6,6] => Solution 6

LeetCode Problem

You are to find a divide and conquer solution to this problem, and implement it on Leetcode.

Then you will do a runtime analysis of your solution.

Turn in:

  1. Source code for your solution
  2. Samples runs showing the operation with input and outputs.
  3. A complete asymptotic analysis.
Be prepared to discuss you solutions in class.

-- TWiki Admin User - 2016-08-14


Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2016-10-10 - JimSkon
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback