Ir ao conteúdo

Pilha, com ponteiros, Estrutura de Dados.

Então, hoje vou demonstrar um dos outros exercicios que fizemos na aula de estrutura de dados, lembrando mais uma vez que estes são exercicios que eu faço rapidamente e não me importo muito com várias coisas pela falta de tempo. O que irei mostrar hoje é uma Pilha com vetores porém em vez de ele ter um inteiro indicando o ultimo elemento, o ultimo será um ponteiro para o ultimo elemento da pilha.

Para ver o enunciado inteiro continue lendo (enunciado grande).

Para baixar o arquivo, clique aqui!

Reimplemente o seu programa de pilha com vetor de números inteiros usando como TOPO um ponteiro para inteiro, que você incrementa, decrementa e testa
para saber se a pilha está cheia ou vazia;
• para resolver:
– modifique a estrutura tPilha da seguinte forma:
constantes MAXPILHA = 100;
tipo tPilha {
inteiro dados[MAXPILHA];
inteiro *topo;
};

• Modifique os algoritmos de manipulação da pilha de forma que se utilize ponteiros para inteiro para referenciar os elementos da pilha.
• Exemplo:
Inteiro FUNÇÃO empilha(inteiro dado)
início
SE (pilhaCheia) ENTÃO
RETORNE(ErroPilhaCheia)
SENÃO
// Se houver espaço, incremento o
// ponteiro topo e faço o valor
// apontado por topo receber o novo
// dado.
aPilha.topo <- aPilha.topo + 1; *(aPilha.topo) <- dado; RETORNE(aPilha.topo); FIM SE fim; • Lembre-se de adaptar a inicialização da pilha e também os testes de pilha cheia e vazia. Exemplos: FUNÇÃO inicializaPilha() início // Fazemos o topo apontar para um endereço de memória // anterior ao início do vetor dados para simbolizar // que a pilha está vazia. aPilha.topo <- aPilha.dados - 1; fim; Booleano FUNÇÃO pilhaVazia() início SE (aPilha.topo < aPilha.dados) ENTÃO // O topo está apontando para um endereço de // memória anterior ao próprio início da // pilha. Segundo a nossa definição, isto // significa que a pilha está vazia. RETORNE(Verdadeiro) SENÃO RETORNE(Falso); fim;

Publicado emAprendendoCEstrutura de Dados

35 Comentários

  1. Sie können diese Spiele live mit unseren erfahrenen und freundlichen Dealern genießen. Der RocketPlay
    Live-Casino-Willkommensbonus sorgt dafür, dass die Spieler
    eine Casino-ähnliche Atmosphäre erleben. Wir bieten jedoch den klassischen Komfort
    von Online-Casinos mit unseren Moderatoren, die in Echtzeit mit Ihnen chatten können.
    Online-Casinos sind eine neue Form des Online-Glücksspiels, wo Sie das
    authentische Gefühl der traditionellen landgestützten Casinos erleben können. Abonnieren Sie unseren Newsletter,
    um von unserem fantastischen Angebot zu profitieren.
    Zusätzlich bieten wir progressive Jackpot-Slots mit
    Millionen-EUR-Preispools, die das Leben deutscher und österreichischer Spieler verändern können. Deutsche und österreichische Spieler müssen ihre Identität verifizieren, um Auszahlungen zu ermöglichen und den vollen Zugang zu unserem
    Casino zu erhalten. Die Rocketplay Casino Registration in unserem Casino ist optimiert für Benutzerfreundlichkeit und Sicherheit.

    Sollten Sie Probleme mit dem access zur site haben oder die Seite
    is not erreichbar sein, steht Ihnen unser Support jederzeit zur Verfügung,
    um Ihnen help zu bieten. Diese Events bieten zusätzliche Gewinnchancen und fördern die Gemeinschaft unter unseren Benutzern. Unsere Rocketplay Casino Bonus
    Codes bieten exklusive Zugang zu speziellen Angeboten für Spieler aus Deutschland und Österreich.

    RocketPlay überzeugt mit einer abwechslungsreichen Spielauswahl für jedes Spielniveau.
    In nur wenigen Schritten startest du dein Casino Abenteuer online.
    Letztendlich kann man sich bei RocketPlay als Spieler davon überzeugen, dass man es mit einem fairen und verantwortungsbewussten Glücksspielbetreiber zu tun hat.
    Diese Plattform wurde geschaffen, um all unsere Bemühungen einer breiten Öffentlichkeit zu
    präsentieren, damit unsere Vision einer sichereren und transparenteren Online-Glücksspielbranche auch in die Realität umgesetzt wird.

    Diese Initiative haben wir mt dem Ziel gestartet, ein globales Selbstausschlusssystem zu
    schaffen, das es gefährdeten Spielern ermöglicht, ihren Zugang
    zu allen Online-Glücksspielmöglichkeiten global zu sperren. Der Spieler aus Deutschland hatte 1000 € eingezahlt und gewonnen, hatte jedoch Probleme mit der Auszahlung,
    da seine Gewinne als Bonusgelder eingestuft wurden, obwohl er den Nachweis hatte,
    ohne Bonus gespielt zu haben.

    References:
    https://online-spielhallen.de/beep-beep-casino-bonus-code-ihr-weg-zu-spannenden-vorteilen/

  2. But here’s the kicker – this 98% RTP isn’t a guarantee for
    your gaming session tonight. Now, let’s chat about volatility –
    the rollercoaster factor of Plinko casino! Plinko typically offers medium-to-high volatility, depending on your pin configuration. Those 98% returns manifest over thousands or millions of
    plays. Choose wisely, play responsibly, and may the pins
    bounce in your favor!
    Utilizing advanced tactics begins with setting realistic objectives and analyzing game patterns.
    Evaluating this digital experience reveals a mix
    of engaging entertainment and notable challenges. The journey from a
    televised gimmick to a digital avenue for earning cash has revolutionized the game.

    References:
    https://blackcoin.co/best-paying-online-casinos-australia-high-rtp-pokies-2025-update/

  3. The Fighting Irish have appeared in the NCAA tournament
    37 times. For employees, Microsoft also operates a commuter bus
    service called “The Connector” that provides non-stop service to neighborhoods in Seattle, the Eastside, and Snohomish County
    from the Redmond campus. The Seattle Times reported in early September 2015 that
    Microsoft had hired architecture firm Skidmore, Owings & Merrill to begin a multibillion-dollar redesign of
    the Redmond campus, using an additional 1.4 million square feet (130,000 m2) allowed by an agreement
    with the City of Redmond. In January 2006, Microsoft announced the
    purchase of Safeco’s Redmond campus after the company had begun consolidating its offices at the Safeco Tower in Seattle’s University District a year
    earlier.
    The 2012 Syracuse team began the game against the Irish with the goal
    of breaking Boston College’s record. Boston College, in its final year as a member
    of the Big East, set the record for most consecutive wins by a Big East team to start a
    season. Also of note is that the 2005 win over Boston College and the 2012 win over Syracuse saw 20–0 teams traveling to South Bend
    and leaving with their first loss of the season.

    References:
    https://blackcoin.co/cocoa-casino-review/

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *