• 제목/요약/키워드: Heap sort

검색결과 3건 처리시간 0.015초

Analysis and Comparison of Sorting Algorithms (Insertion, Merge, and Heap) Using Java

  • Khaznah, Alhajri;Wala, Alsinan;Sahar, Almuhaishi;Fatimah, Alhmood;Narjis, AlJumaia;Azza., A.A
    • International Journal of Computer Science & Network Security
    • /
    • 제22권12호
    • /
    • pp.197-204
    • /
    • 2022
  • Sorting is an important data structure in many applications in the real world. Several sorting algorithms are currently in use for searching and other operations. Sorting algorithms rearrange the elements of an array or list based on the elements' comparison operators. The comparison operator is used in the accurate data structure to establish the new order of elements. This report analyzes and compares the time complexity and running time theoretically and experimentally of insertion, merge, and heap sort algorithms. Java language is used by the NetBeans tool to implement the code of the algorithms. The results show that when dealing with sorted elements, insertion sort has a faster running time than merge and heap algorithms. When it comes to dealing with a large number of elements, it is better to use the merge sort. For the number of comparisons for each algorithm, the insertion sort has the highest number of comparisons.

유전 알고리즘을 이용한 정렬 알고리즘의 최악의 인스턴스 탐색 (Finding the Worst-case Instances of Some Sorting Algorithms Using Genetic Algorithms)

  • 전소영;김용혁
    • 한국정보과학회:학술대회논문집
    • /
    • 한국정보과학회 2010년도 한국컴퓨터종합학술대회논문집 Vol.37 No.1(B)
    • /
    • pp.1-5
    • /
    • 2010
  • 정렬 알고리즘에서 사용한 원소 간 비교횟수를 기준으로, 비교횟수가 많게 되는 순열을 최악의 인스턴스(worst-case instance)라 명명하고 이를 찾기 위해 유전 알고리즘(genetic algorithm)을 사용하였다. 잘 알려진 퀵 정렬(quick sort), 머지 정렬(merge sort), 힙 정렬(heap sort), 삽입 정렬(insertion sort), 쉘 정렬(shell sort), 개선된 퀵 정렬(advanced quick sort)에 대해서 실험하였다. 머지 정렬과 삽입 정렬에 대해 탐색한 인스턴스는 최악의 인스턴스에 거의 근접하였다. 퀵 정렬은 크기가 증가함에 따라 최악의 인스턴스 탐색이 어려웠다. 나머지 정렬에 대해서 찾은 인스턴스는 최악의 인스턴스인지 이론적으로 보장할 수 없지만, 임의의 1,000개 순열을 정렬해서 얻은 비교횟수들의 평균치보다는 훨씬 높았다. 본 논문의 최악의 인스턴스를 탐색하는 시도는 알고리즘의 성능 검증을 위한 테스트 데이터를 생성한다는 점에서 의미가 크다.

  • PDF

초등학교의 자료구조와 알고리즘 수업에서 알고리즘 시각화의 교육적 효과 (Pedagogical effectiveness of algorithm visualizations in teaching the data structures and algorithms in elementary schools)

  • 전석주
    • 정보교육학회논문지
    • /
    • 제16권2호
    • /
    • pp.255-263
    • /
    • 2012
  • 정보화 사회에서 우수한 S/ W 인력을 양성하기 위해 알고리즘의 조기 교육은 매우 중요하다. 그러나 초등학생에게 알고리즘을 교육하는 것은 큰 도전인데 왜냐하면 텍스트형태의 컴퓨터 알고리즘이 어떻게 동작하는 지를 어린 학생들이 이해하기가 매우 어렵기 때문이다. 애니메이션을 활용한 수업 통해 알고리즘 수업을 실시한다면 학생들이 좀 더 쉽게 알고리즘을 시각화 할 수 있을 것으로 기대된다. 본 연구에서는 초등학교에서 기초적인 자료구조와 알고리즘을 교육하는데 있어서 알고리즘 시각화의 교육적 효과를 평가하고자 한다. 이를 위해 '알고리즘 시각화 팩터'라는 새로운 측정도구를 정의하고 알고리즘 교육요소 즉, 스택, 큐, 버블정렬, 힙정렬, BFS, 및 DFS에 대해 텍스트 기반과 애니메니션 기반의 강의 자료를 각각 개발하였다. 다양한 학생 그룹에 대해 실험을 하고 평가를 하였다. 폭넓은 실험을 통해 애니메이션 기반의 강의 자료를 사용한 그룹의 평균 점수가 텍스트기반의 강의 자료를 사용한 그룹에 대해 22.2% 이상 더 높은 점수 결과를 보였다.

  • PDF