Skip to content

CAU-DOSC/DevSet1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๊ณผ์ œ2: ๊ฐœ๋ฐœ / ์‹คํ–‰ / ๋ถ„์„

  • 5(4)๋ช…์ด 1 team์œผ๋กœ ์ž‘์—…
    • ์กฐ์žฅ(1) , ์กฐ์›(๋‚˜๋จธ์ง€)
    • ๊ฐ์กฐ์— ๋Œ€ํ•˜์—ฌ ์กฐ์žฅ์ด maintainer์ธ repository DevSetN๋ถ€์—ฌ
      • DevSet2, DevSet2, โ€ฆ DevSet9
      • DevSet1 repository ์— guide ๋“ฑ ๊ด€๋ จ ๋‚ด์šฉ posting
      • Repository DevSetN ์€ ์กฐ์žฅ(maintainer)๋งŒ push ํ•  ์ˆ˜ ์žˆ์Œ
      • ์กฐ์›์€ maintainer์—๊ฒŒ PR์„ ํ†ตํ•˜์—ฌ push ๊ฐ€๋Šฅ
    • ๊ฐ repository์—๋Š” ๋‹ค์Œ์˜ file ๋“ค์ด ์ƒ์„ฑ๋˜์–ด์•ผ ํ•จ
      • README. md : ๊ณผ์ œ์ง„ํ–‰์— ๋Œ€ํ•œ ์„ค๋ช…, ์—ญํ• ๋ถ„๋‹ด ๋“ฑ๋“ฑ
      • FINAL.md : ๊ณผ์ œ ๊ฒฐ๊ณผ ๋ถ„์„์— ๋Œ€ํ•œ ๋‚ด์šฉ ๊ธฐ๋ก(์ง„ํ–‰๊ณผ์ • ํฌํ•จ) +Source files
  • Works to do
    • Implementation of each code
      • Unit test for implementations
        • Periodic(or continuous) build and smoke test
      • Performance tuning
      • Due to June 21st
  • ์ˆ˜ํ–‰๋ฐฉ๋ฒ•์€ ์กฐ๋ณ„๋กœ ํ˜‘์˜๋ฅผ ํ†ตํ•˜์—ฌ ๊ฒฐ์ •ํ•˜์—ฌ ์‹คํ–‰
    • ๋ชจ๋“  ์กฐ์›์ด ์•„๋ž˜ ๊ฐ ๋ถ€๋ฌธ์— ์—ญํ• ์ด ์ •์˜๋˜๊ณ  ์‹คํ–‰๋˜์–ด์•ผ ํ•จ
      • Implementation of code(unit test๋ฅผ ํฌํ•จํ•˜์—ฌ)
      • Performance ์ธก์ •์„ ํ†ตํ•œ ๋ถ„์„ ๋ฐ ๊ฐœ์„ 

Problem: SET Implementation

  • A sorted sequence of m random integers in [0, maxval), without duplicates
    • SET implementation of โ€˜maxvalโ€™ elements
  • Same interfaces with different implementation of 5 data structures
    • Arrays
    • Simple lists
    • Binary search tree(list)
    • Bit vectors
    • Bins (buckets)
  • Experiments 5 implementation with proper โ€˜maxvalโ€™ and โ€˜mโ€™ values
    • Time complexity โ€“ elapsed time to create m-elements set
    • Space complexity โ€“ spaces required to create same set
  • Refine implementation to get reasonable performance result
    • Performance rank in terms of TIME and SPACE

Interface

  • IntSet as set of integers

    • IntSetxxx: xxx as a qualifier
    • IntSetArr, IntSetList, IntSetBST, IntSetBitVec, IntSetBins
  • intSetImp(int maxelems, int maxval)

    • initializes the set to empty
    • maxelems: maximum number of elements
    • maxval: maximum value of any element
  • insert(int element)

    • adds a new integer to the set, if it is not already present
  • size()

    • tells the current number of elements
  • report(int *v)

    • returns elements in sorted order

A C++ code

  • An example code to generate a sorted set of random integers

void gensets(int m, int maxval)

{ int *v = new int[m];

  IntSetImp S(m, maxval);

  while (S.size() < m)

	    S.insert(bigrand() % maxval);
    
  S.report(v);

for (int i = 0; i < m; i++)

  cout << v[i] << "\n";

}

Performance tuning

  • maxval = n = ใ€–10ใ€—^8 , ใ€–10ใ€—^6

  • maxelements: m = n/100, n/50, n/25

  • Set generation experiments measured for 5 cases excluding i/o

    • Time elapsed
      • initialize / insert / report / Total
    • Total space required
      • for SET implementation
  • Improve performance

    • Implementation and measure
    • Performance upgrade iterations

EX: code for bit vector

class IntSetBitVec {

private:

enum { BITSPERWORD = 32, SHIFT = 5, MASK = 0x1F };

int n, hi, *x;

void set(int i) { x[i>>SHIFT] |= (1<<(i & MASK)); }

void clr(int i) { x[i>>SHIFT] &= ~(1<<(i & MASK)); }

int test(int i) { return x[i>>SHIFT] & (i<<(i & MASK)); }

public:

IntSetBitVec(maxelements, maxval)

{ hi = maxval;

  x = new int[1 + hi/BITSPERWORD];

  for (int i = 0; i < hi; i++)

	  clr(i);

   n = 0;

}

int size() { return n; }

void insert(t)

{ if (test(t))

	return;

set(t);

n++;

}

void report(int *v)

{ j = 0

for (int i = 0; i < hi; i++)

	if test(i)

		v[j++] = i

}

};

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors