• 파일시티 이벤트
  • LF몰 이벤트
  • 서울좀비 이벤트
  • 탑툰 이벤트
  • 닥터피엘 이벤트
  • 아이템베이 이벤트
  • 아이템매니아 이벤트

[자료구조] [샤니]3장 연습문제 풀이

*정*
최초 등록일
2005.08.03
최종 저작일
2005.04
14페이지/한글파일 한컴오피스
가격 1,500원 할인쿠폰받기
다운로드
장바구니

소개글

샤니의 자료구조론 연습문제풀이입니다.

목차

없음

본문내용

14. Suppose that we are to represent a linear list the formula

location(i)=(location(1)+i-1) % MaxSize

where MaxSize is the size of the array in which the elements are stored. Rather than storing the list size explicitly, we keep variables first and last that give the locations of the first and last elements of the list.

(a) Develop a class similar to LinearList for this representation.

template<class T>
class LinearList {
public:
LinearList(int MaxListSize = 10); // constructor
~LinearList() {delete [] element;} // destructor
bool IsEmpty() const {return first == -1;}

int Length() const // Length 함수를 정의함으로써 length 변수의 역할을 대신한다.
{if (first == -1) return 0;
else return (MaxSize+last-first) % MaxSize + 1;}

bool Find(int k, T& x) const;
// return the k'th element of list in x
int Search(const T& x) const;
// return position of x
LinearList<T>& Delete(int k, T& x);
// delete k'th element and return in x
LinearList<T>& Insert(int k, const T& x);
// insert x just after k'th element
void Output(ostream& out) const;

private:
int first; // location of first element
int last; // location of last element
int MaxSize;
T *element; // dynamic 1D array
};

참고 자료

샤니의 자료구조론 3장 연습문제 풀이입니다.
*정*
판매자 유형Bronze개인

주의사항

저작권 자료의 정보 및 내용의 진실성에 대하여 해피캠퍼스는 보증하지 않으며, 해당 정보 및 게시물 저작권과 기타 법적 책임은 자료 등록자에게 있습니다.
자료 및 게시물 내용의 불법적 이용, 무단 전재∙배포는 금지되어 있습니다.
저작권침해, 명예훼손 등 분쟁 요소 발견 시 고객센터의 저작권침해 신고센터를 이용해 주시기 바랍니다.
환불정책

해피캠퍼스는 구매자와 판매자 모두가 만족하는 서비스가 되도록 노력하고 있으며, 아래의 4가지 자료환불 조건을 꼭 확인해주시기 바랍니다.

파일오류 중복자료 저작권 없음 설명과 실제 내용 불일치
파일의 다운로드가 제대로 되지 않거나 파일형식에 맞는 프로그램으로 정상 작동하지 않는 경우 다른 자료와 70% 이상 내용이 일치하는 경우 (중복임을 확인할 수 있는 근거 필요함) 인터넷의 다른 사이트, 연구기관, 학교, 서적 등의 자료를 도용한 경우 자료의 설명과 실제 자료의 내용이 일치하지 않는 경우

이런 노하우도 있어요!더보기

최근 본 자료더보기
탑툰 이벤트
[자료구조] [샤니]3장 연습문제 풀이
  • 레이어 팝업
  • 레이어 팝업
  • 레이어 팝업
  • 레이어 팝업
  • 레이어 팝업