嗅谱网

技术分享

  • 拓扑排序 C++ 代码

    拓扑排序 C++ 代码

    拓扑排序 C++ 代码 /**Program:TopologicalSort*Author:Yee-fan Zhu*/#include <fstream>using namespace std;ifstream fin("topo.in");ofstream fout("topo.out");bool TopologicalSort(int a[][101],int *ans) //可以完成拓扑排序则返回True   {        int n = a[0][0], i, j;  & ...

    查看全文

  • 拓扑排序 C 代码

    拓扑排序 C 代码

    拓扑排序 C 代码 /*  topsort.c    Topologically sort a directed acyclic graph (DAG)    by: Steven Skiena    begun: March 26, 2002*//*Copyright 2003 by Steven S. Skiena; all rights reserved. Permission is granted for use in non-commerical applicationspro ...

    查看全文

  • 连通图 C 代码

    连通图 C 代码

    连通图 C 代码 /*  connected.c    Compute the connected components of a graph.    by: Steven Skiena    begun: March 6, 2002*//*Copyright 2003 by Steven S. Skiena; all rights reserved. Permission is granted for use in non-commerical applicationsprovided ...

    查看全文

  • 深度优先搜索 C 代码

    深度优先搜索 C 代码

    深度优先搜索 C 代码 /*  bfs-dfs.c    A generic implementation of graph traversal: breadth-first    and depth-first search    begun: March 27, 2002    by: Steven Skiena*//*Copyright 2003 by Steven S. Skiena; all rights reserved. Permission ...

    查看全文

  • 广度优先搜索 C++ 代码

    广度优先搜索 C++ 代码

    广度优先搜索 C++ 代码 #include <iostream>using namespace std;struct node {int info;node *next;};class Queue {public:Queue();~Queue();bool isEmpty();void add(int);int get();private:node *first, *last;};class Graph {public:Graph(int size = 2);~Graph();bool isConnected(int, int);// adds the (x, y) pa ...

    查看全文

  • 广度优先搜索 C 代码

    广度优先搜索 C 代码

    广度优先搜索 C 代码 /*  bfs-dfs.c    A generic implementation of graph traversal: breadth-first    and depth-first search    begun: March 27, 2002    by: Steven Skiena*//*Copyright 2003 by Steven S. Skiena; all rights reserved. Permission ...

    查看全文

  • 歪斜堆 C++ 代码

    歪斜堆 C++ 代码

    歪斜堆 C++ 代码 /******************************************************************************* File: SkewBinomialHeap.hh* Author: Keith Schwarz (htiek@cs.stanford.edu)** An implementation of a priority queue backed by a skew binomial heap.  Like* regular binomial heaps, skew binomial heaps are ...

    查看全文

  • 左倾堆 C 代码

    左倾堆 C 代码

    左倾堆 C 代码         #include "leftheap.h"        #include "fatal.h"        #include <stdlib.h>        struct TreeNode       ...

    查看全文

  • 斐波那契堆 Java 代码

    斐波那契堆 Java 代码

    斐波那契堆 Java 代码 /**   * Licensed to the Apache Software Foundation (ASF) under one or more   * contributor license agreements.  See the NOTICE file distributed with   * this work for additional information regarding copyright ownership.   * The ASF lice ...

    查看全文

  • 二项堆 Java 代码

    二项堆 Java 代码

    二项堆 Java 代码 // BinomialQueue class   //   // CONSTRUCTION: with no parameters or a single item   //   // ******************PUBLIC OPERATIONS*********************   // void insert( x )       --> Insert x   ...

    查看全文

  • 堆 C++ 代码

    堆 C++ 代码

    堆 C++ 代码 // File name: HeapTree.h// Author: Arman Sahakyan// Copyright (C) 2007, The CodeProject// Contact: arman_sahakyan@edu.aua.am#pragma oncetemplate <class TID, class TDATA>class CHeapTree{    int m_nSize;    int m_nMAX;    const int m_nIni ...

    查看全文

  • 堆排序 Java 代码

    堆排序 Java 代码

    堆排序 Java 代码 /** @(#)HeapSortAlgorithm.java   1.0 95/06/23 Jason Harrison** Copyright (c) 1995 University of British Columbia** Permission to use, copy, modify, and distribute this software* and its documentation for NON-COMMERCIAL purposes and without* fee is hereby granted provided th ...

    查看全文