Em Andamento

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

Ver mais: write recursive function, recursive programming, recursive problem, programming cpp, int size, programming typedef, programming function, programming array, cpp return array, cpp programming, cpp list, cpp array, array cpp, array programming, adt programming, recursive, bool, php file array, array form, form array, php file write array, php form array, sure problem, php file operation, recursive php

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

ID do Projeto: #2961027

Premiar a:


See private message.

$5 USD em 5 dias
(94 Avaliações)

4 freelancers estão ofertando em média $8 para este 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)