C++ Recursive Array Problem

Write a recursive array-based implementation of the retrieval operation for the ADT list given in the attached file (and copied below). The operation should take the array, an item and the size of the array as parameters and return the position of the item. Be sure that the function calls itself with a smaller problem size. //Header File const int MAX_LIST = 10; typedef int listItemType; class listClass { public: listClass(); //list operations: bool ListIsEmpty() const; int ListLength() const; void ListInsert(int NewPosition, listItemType NewItem, bool& Success); void ListDelete(int Position, bool& Success); void ListRetrieve(int Position, listItemType& DataItem, bool& Success) const; private: listItemType Items[MAX_LIST]; int Size; int Index(int Position) const; }; //CPP File #include "ListA.h" listClass::listClass() : Size(0) { } bool listClass::ListIsEmpty() const { return bool(Size == 0); } int listClass::ListLength() const { return Size; } void listClass::ListInsert(int NewPosition, listItemType NewItem, bool& Success) { Success = bool( (NewPosition >= 1) && (NewPosition <= Size+1) && (Size < MAX_LIST)); if (Success) { for (int Position = Size; Position >= NewPosition; --Position) { Items[Index(Position+1)] = Items[Index(Position)]; } Items[Index(NewPosition)] = NewItem; ++Size; } } void listClass::ListDelete(int Position, bool& Success) { Success = bool((Position >= 1) && (Position <= Size)); if (Success) { for (int FromPosition = Position+1; FromPosition <= Size; ++FromPosition) { Items[Index(FromPosition-1)] = Items[Index(FromPosition)]; } --Size; } } void listClass::ListRetrieve(int Position, listItemType& DataItem, bool& Success) const { Success = bool((Position >= 1) && (Position <= Size)); if (Success) { DataItem = Items[Index(Position)]; } } int listClass::Index(int Position) const { return Position-1; }

## Deliverables

1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. 2) Complete ownership and distribution copyrights to all work purchased.

## Platform


Habilidades: Programação C, Engenharia, MySQL, PHP, Arquitetura de software, Teste de Software

Veja mais: write a recursive function, recursive programming, recursive problem, programming with cpp, programming array, int size c, c programming typedef, c++ programming problem, c programming function, c programming class, c programming array, cpp return array, cpp programming, cpp list, cpp array, c for int, array programming, array in c programming, array in cpp, array c programming, a recursive function, adt programming, recursive, bool, php file array

Acerca do Empregador:
( 6 comentários ) United States

ID do Projeto: #2961027

Concedido a:


See private message.

$5 USD em 5 dias
(94 Comentários)

4 freelancers estão ofertando em média $8 para esse trabalho


See private message.

$12.75 USD in 5 dias
(175 Comentários)

See private message.

$10.2 USD in 5 dias
(10 Comentários)

See private message.

$5.1 USD in 5 dias
(0 Comentários)