AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Build Heap And Heapsort Without Array

Ein Thema von sk.Silvia · begonnen am 1. Mai 2006 · letzter Beitrag vom 13. Mai 2006
Antwort Antwort
Benutzerbild von sk.Silvia
sk.Silvia

Registriert seit: 8. Feb 2006
Ort: Slovenia
90 Beiträge
 
Delphi 7 Personal
 
#1

Re: Build Heap And Heapsort Without Array

  Alt 12. Mai 2006, 15:28
so ok, i have this code :

Delphi-Quellcode:
  procedure TBinTree.BuildHeap;
      begin
      if not(Left=nil) then
        begin
        if Left.Value>Value then
          begin
          Exchange(Left,Self);
          BuildHeap;
          end;
        Left.BuildHeap;
        end;
      if not(Right=nil) then
        begin
        if Right.Value>Value then
          begin
          Exchange(Right,Self);
          BuildHeap;
          end;
        Right.BuildHeap;
        end;
      end;
it works fine, but only just with one bug, it exchanges bad the values by the tree root (it dont makes just one exchange, the rest of the tree is ok)

somebody has an idea how to fix it?
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:22 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz