{"action":"closed","number":1,"pull_request":{"url":"https://api.github.com/repos/abhishekbundela/data-structures/pulls/1","id":52859898,"html_url":"https://github.com/abhishekbundela/data-structures/pull/1","diff_url":"https://github.com/abhishekbundela/data-structures/pull/1.diff","patch_url":"https://github.com/abhishekbundela/data-structures/pull/1.patch","issue_url":"https://api.github.com/repos/abhishekbundela/data-structures/issues/1","number":1,"state":"closed","locked":false,"title":"priority queue","user":{"login":"gitshbhts","id":11510558,"avatar_url":"https://avatars.githubusercontent.com/u/11510558?v=3","gravatar_id":"","url":"https://api.github.com/users/gitshbhts","html_url":"https://github.com/gitshbhts","followers_url":"https://api.github.com/users/gitshbhts/followers","following_url":"https://api.github.com/users/gitshbhts/following{/other_user}","gists_url":"https://api.github.com/users/gitshbhts/gists{/gist_id}","starred_url":"https://api.github.com/users/gitshbhts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gitshbhts/subscriptions","organizations_url":"https://api.github.com/users/gitshbhts/orgs","repos_url":"https://api.github.com/users/gitshbhts/repos","events_url":"https://api.github.com/users/gitshbhts/events{/privacy}","received_events_url":"https://api.github.com/users/gitshbhts/received_events","type":"User","site_admin":false},"body":"#include <stdio.h>\r\n#include <stdlib.h>\r\n \r\n#define MAX 5\r\n \r\nvoid insert_by_priority(int);\r\nvoid delete_by_priority(int);\r\nvoid create();\r\nvoid check(int);\r\nvoid display_pqueue();\r\n \r\nint pri_que[MAX];\r\nint front, rear;\r\n \r\nvoid main()\r\n{\r\n    int n, ch;\r\n \r\n    printf(\"\\n1 - Insert an element into queue\");\r\n    printf(\"\\n2 - Delete an element from queue\");\r\n    printf(\"\\n3 - Display queue elements\");\r\n    printf(\"\\n4 - Exit\");\r\n \r\n    create();\r\n \r\n    while (1)\r\n    {\r\n        printf(\"\\nEnter your choice : \");    \r\n        scanf(\"%d\", &ch);\r\n \r\n        switch (ch)\r\n        {\r\n        case 1: \r\n            printf(\"\\nEnter value to be inserted : \");\r\n            scanf(\"%d\",&n);\r\n            insert_by_priority(n);\r\n            break;\r\n        case 2:\r\n            printf(\"\\nEnter value to delete : \");\r\n            scanf(\"%d\",&n);\r\n            delete_by_priority(n);\r\n            break;\r\n        case 3: \r\n            display_pqueue();\r\n            break;\r\n        case 4: \r\n            exit(0);\r\n        default: \r\n            printf(\"\\nChoice is incorrect, Enter a correct choice\");\r\n        }\r\n    }\r\n}\r\n \r\n/* Function to create an empty priority queue */\r\nvoid create()\r\n{\r\n    front = rear = -1;\r\n}\r\n \r\n/* Function to insert value into priority queue */\r\nvoid insert_by_priority(int data)\r\n{\r\n    if (rear >= MAX - 1)\r\n    {\r\n        printf(\"\\nQueue overflow no more elements can be inserted\");\r\n        return;\r\n    }\r\n    if ((front == -1) && (rear == -1))\r\n    {\r\n        front++;\r\n        rear++;\r\n        pri_que[rear] = data;\r\n        return;\r\n    }    \r\n    else\r\n        check(data);\r\n    rear++;\r\n}\r\n \r\n/* Function to check priority and place element */\r\nvoid check(int data)\r\n{\r\n    int i,j;\r\n \r\n    for (i = 0; i <= rear; i++)\r\n    {\r\n        if (data >= pri_que[i])\r\n        {\r\n            for (j = rear + 1; j > i; j--)\r\n            {\r\n                pri_que[j] = pri_que[j - 1];\r\n            }\r\n            pri_que[i] = data;\r\n            return;\r\n        }\r\n    }\r\n    pri_que[i] = data;\r\n}\r\n \r\n/* Function to delete an element from queue */\r\nvoid delete_by_priority(int data)\r\n{\r\n    int i;\r\n \r\n    if ((front==-1) && (rear==-1))\r\n    {\r\n        printf(\"\\nQueue is empty no elements to delete\");\r\n        return;\r\n    }\r\n \r\n    for (i = 0; i <= rear; i++)\r\n    {\r\n        if (data == pri_que[i])\r\n        {\r\n            for (; i < rear; i++)\r\n            {\r\n                pri_que[i] = pri_que[i + 1];\r\n            }\r\n \r\n        pri_que[i] = -99;\r\n        rear--;\r\n \r\n        if (rear == -1) \r\n            front = -1;\r\n        return;\r\n        }\r\n    }\r\n    printf(\"\\n%d not found in queue to delete\", data);\r\n}\r\n \r\n/* Function to display queue elements */\r\nvoid display_pqueue()\r\n{\r\n    if ((front == -1) && (rear == -1))\r\n    {\r\n        printf(\"\\nQueue is empty\");\r\n        return;\r\n    }\r\n \r\n    for (; front <= rear; front++)\r\n    {\r\n        printf(\" %d \", pri_que[front]);\r\n    }\r\n \r\n    front = 0;\r\n}","created_at":"2015-12-07T15:41:02Z","updated_at":"2015-12-07T15:41:25Z","closed_at":"2015-12-07T15:41:25Z","merged_at":null,"merge_commit_sha":"22aa9819e2b12071b612a4af6b27af5705ff8d88","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/abhishekbundela/data-structures/pulls/1/commits","review_comments_url":"https://api.github.com/repos/abhishekbundela/data-structures/pulls/1/comments","review_comment_url":"https://api.github.com/repos/abhishekbundela/data-structures/pulls/comments{/number}","comments_url":"https://api.github.com/repos/abhishekbundela/data-structures/issues/1/comments","statuses_url":"https://api.github.com/repos/abhishekbundela/data-structures/statuses/b11d8c2179f4956558b1bdc4d5ca2a80e141a4c9","head":{"label":"anoopsingh1996:master","ref":"master","sha":"b11d8c2179f4956558b1bdc4d5ca2a80e141a4c9","user":{"login":"anoopsingh1996","id":9657488,"avatar_url":"https://avatars.githubusercontent.com/u/9657488?v=3","gravatar_id":"","url":"https://api.github.com/users/anoopsingh1996","html_url":"https://github.com/anoopsingh1996","followers_url":"https://api.github.com/users/anoopsingh1996/followers","following_url":"https://api.github.com/users/anoopsingh1996/following{/other_user}","gists_url":"https://api.github.com/users/anoopsingh1996/gists{/gist_id}","starred_url":"https://api.github.com/users/anoopsingh1996/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anoopsingh1996/subscriptions","organizations_url":"https://api.github.com/users/anoopsingh1996/orgs","repos_url":"https://api.github.com/users/anoopsingh1996/repos","events_url":"https://api.github.com/users/anoopsingh1996/events{/privacy}","received_events_url":"https://api.github.com/users/anoopsingh1996/received_events","type":"User","site_admin":false},"repo":{"id":43930595,"name":"data-structures","full_name":"anoopsingh1996/data-structures","owner":{"login":"anoopsingh1996","id":9657488,"avatar_url":"https://avatars.githubusercontent.com/u/9657488?v=3","gravatar_id":"","url":"https://api.github.com/users/anoopsingh1996","html_url":"https://github.com/anoopsingh1996","followers_url":"https://api.github.com/users/anoopsingh1996/followers","following_url":"https://api.github.com/users/anoopsingh1996/following{/other_user}","gists_url":"https://api.github.com/users/anoopsingh1996/gists{/gist_id}","starred_url":"https://api.github.com/users/anoopsingh1996/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anoopsingh1996/subscriptions","organizations_url":"https://api.github.com/users/anoopsingh1996/orgs","repos_url":"https://api.github.com/users/anoopsingh1996/repos","events_url":"https://api.github.com/users/anoopsingh1996/events{/privacy}","received_events_url":"https://api.github.com/users/anoopsingh1996/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/anoopsingh1996/data-structures","description":"ds","fork":false,"url":"https://api.github.com/repos/anoopsingh1996/data-structures","forks_url":"https://api.github.com/repos/anoopsingh1996/data-structures/forks","keys_url":"https://api.github.com/repos/anoopsingh1996/data-structures/keys{/key_id}","collaborators_url":"https://api.github.com/repos/anoopsingh1996/data-structures/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/anoopsingh1996/data-structures/teams","hooks_url":"https://api.github.com/repos/anoopsingh1996/data-structures/hooks","issue_events_url":"https://api.github.com/repos/anoopsingh1996/data-structures/issues/events{/number}","events_url":"https://api.github.com/repos/anoopsingh1996/data-structures/events","assignees_url":"https://api.github.com/repos/anoopsingh1996/data-structures/assignees{/user}","branches_url":"https://api.github.com/repos/anoopsingh1996/data-structures/branches{/branch}","tags_url":"https://api.github.com/repos/anoopsingh1996/data-structures/tags","blobs_url":"https://api.github.com/repos/anoopsingh1996/data-structures/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/anoopsingh1996/data-structures/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/anoopsingh1996/data-structures/git/refs{/sha}","trees_url":"https://api.github.com/repos/anoopsingh1996/data-structures/git/trees{/sha}","statuses_url":"https://api.github.com/repos/anoopsingh1996/data-structures/statuses/{sha}","languages_url":"https://api.github.com/repos/anoopsingh1996/data-structures/languages","stargazers_url":"https://api.github.com/repos/anoopsingh1996/data-structures/stargazers","contributors_url":"https://api.github.com/repos/anoopsingh1996/data-structures/contributors","subscribers_url":"https://api.github.com/repos/anoopsingh1996/data-structures/subscribers","subscription_url":"https://api.github.com/repos/anoopsingh1996/data-structures/subscription","commits_url":"https://api.github.com/repos/anoopsingh1996/data-structures/commits{/sha}","git_commits_url":"https://api.github.com/repos/anoopsingh1996/data-structures/git/commits{/sha}","comments_url":"https://api.github.com/repos/anoopsingh1996/data-structures/comments{/number}","issue_comment_url":"https://api.github.com/repos/anoopsingh1996/data-structures/issues/comments{/number}","contents_url":"https://api.github.com/repos/anoopsingh1996/data-structures/contents/{+path}","compare_url":"https://api.github.com/repos/anoopsingh1996/data-structures/compare/{base}...{head}","merges_url":"https://api.github.com/repos/anoopsingh1996/data-structures/merges","archive_url":"https://api.github.com/repos/anoopsingh1996/data-structures/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/anoopsingh1996/data-structures/downloads","issues_url":"https://api.github.com/repos/anoopsingh1996/data-structures/issues{/number}","pulls_url":"https://api.github.com/repos/anoopsingh1996/data-structures/pulls{/number}","milestones_url":"https://api.github.com/repos/anoopsingh1996/data-structures/milestones{/number}","notifications_url":"https://api.github.com/repos/anoopsingh1996/data-structures/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/anoopsingh1996/data-structures/labels{/name}","releases_url":"https://api.github.com/repos/anoopsingh1996/data-structures/releases{/id}","created_at":"2015-10-09T03:26:01Z","updated_at":"2015-11-30T04:35:23Z","pushed_at":"2015-11-30T14:11:32Z","git_url":"git://github.com/anoopsingh1996/data-structures.git","ssh_url":"git@github.com:anoopsingh1996/data-structures.git","clone_url":"https://github.com/anoopsingh1996/data-structures.git","svn_url":"https://github.com/anoopsingh1996/data-structures","homepage":null,"size":0,"stargazers_count":3,"watchers_count":3,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":0,"forks":6,"open_issues":0,"watchers":3,"default_branch":"master"}},"base":{"label":"abhishekbundela:master","ref":"master","sha":"b348430f4bb5032993781070f525dd3a217697e0","user":{"login":"abhishekbundela","id":8913358,"avatar_url":"https://avatars.githubusercontent.com/u/8913358?v=3","gravatar_id":"","url":"https://api.github.com/users/abhishekbundela","html_url":"https://github.com/abhishekbundela","followers_url":"https://api.github.com/users/abhishekbundela/followers","following_url":"https://api.github.com/users/abhishekbundela/following{/other_user}","gists_url":"https://api.github.com/users/abhishekbundela/gists{/gist_id}","starred_url":"https://api.github.com/users/abhishekbundela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhishekbundela/subscriptions","organizations_url":"https://api.github.com/users/abhishekbundela/orgs","repos_url":"https://api.github.com/users/abhishekbundela/repos","events_url":"https://api.github.com/users/abhishekbundela/events{/privacy}","received_events_url":"https://api.github.com/users/abhishekbundela/received_events","type":"User","site_admin":false},"repo":{"id":44310737,"name":"data-structures","full_name":"abhishekbundela/data-structures","owner":{"login":"abhishekbundela","id":8913358,"avatar_url":"https://avatars.githubusercontent.com/u/8913358?v=3","gravatar_id":"","url":"https://api.github.com/users/abhishekbundela","html_url":"https://github.com/abhishekbundela","followers_url":"https://api.github.com/users/abhishekbundela/followers","following_url":"https://api.github.com/users/abhishekbundela/following{/other_user}","gists_url":"https://api.github.com/users/abhishekbundela/gists{/gist_id}","starred_url":"https://api.github.com/users/abhishekbundela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhishekbundela/subscriptions","organizations_url":"https://api.github.com/users/abhishekbundela/orgs","repos_url":"https://api.github.com/users/abhishekbundela/repos","events_url":"https://api.github.com/users/abhishekbundela/events{/privacy}","received_events_url":"https://api.github.com/users/abhishekbundela/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abhishekbundela/data-structures","description":"ds","fork":true,"url":"https://api.github.com/repos/abhishekbundela/data-structures","forks_url":"https://api.github.com/repos/abhishekbundela/data-structures/forks","keys_url":"https://api.github.com/repos/abhishekbundela/data-structures/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abhishekbundela/data-structures/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abhishekbundela/data-structures/teams","hooks_url":"https://api.github.com/repos/abhishekbundela/data-structures/hooks","issue_events_url":"https://api.github.com/repos/abhishekbundela/data-structures/issues/events{/number}","events_url":"https://api.github.com/repos/abhishekbundela/data-structures/events","assignees_url":"https://api.github.com/repos/abhishekbundela/data-structures/assignees{/user}","branches_url":"https://api.github.com/repos/abhishekbundela/data-structures/branches{/branch}","tags_url":"https://api.github.com/repos/abhishekbundela/data-structures/tags","blobs_url":"https://api.github.com/repos/abhishekbundela/data-structures/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abhishekbundela/data-structures/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abhishekbundela/data-structures/git/refs{/sha}","trees_url":"https://api.github.com/repos/abhishekbundela/data-structures/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abhishekbundela/data-structures/statuses/{sha}","languages_url":"https://api.github.com/repos/abhishekbundela/data-structures/languages","stargazers_url":"https://api.github.com/repos/abhishekbundela/data-structures/stargazers","contributors_url":"https://api.github.com/repos/abhishekbundela/data-structures/contributors","subscribers_url":"https://api.github.com/repos/abhishekbundela/data-structures/subscribers","subscription_url":"https://api.github.com/repos/abhishekbundela/data-structures/subscription","commits_url":"https://api.github.com/repos/abhishekbundela/data-structures/commits{/sha}","git_commits_url":"https://api.github.com/repos/abhishekbundela/data-structures/git/commits{/sha}","comments_url":"https://api.github.com/repos/abhishekbundela/data-structures/comments{/number}","issue_comment_url":"https://api.github.com/repos/abhishekbundela/data-structures/issues/comments{/number}","contents_url":"https://api.github.com/repos/abhishekbundela/data-structures/contents/{+path}","compare_url":"https://api.github.com/repos/abhishekbundela/data-structures/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abhishekbundela/data-structures/merges","archive_url":"https://api.github.com/repos/abhishekbundela/data-structures/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abhishekbundela/data-structures/downloads","issues_url":"https://api.github.com/repos/abhishekbundela/data-structures/issues{/number}","pulls_url":"https://api.github.com/repos/abhishekbundela/data-structures/pulls{/number}","milestones_url":"https://api.github.com/repos/abhishekbundela/data-structures/milestones{/number}","notifications_url":"https://api.github.com/repos/abhishekbundela/data-structures/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abhishekbundela/data-structures/labels{/name}","releases_url":"https://api.github.com/repos/abhishekbundela/data-structures/releases{/id}","created_at":"2015-10-15T10:32:48Z","updated_at":"2015-10-15T10:32:49Z","pushed_at":"2015-12-07T15:41:02Z","git_url":"git://github.com/abhishekbundela/data-structures.git","ssh_url":"git@github.com:abhishekbundela/data-structures.git","clone_url":"https://github.com/abhishekbundela/data-structures.git","svn_url":"https://github.com/abhishekbundela/data-structures","homepage":null,"size":95,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/abhishekbundela/data-structures/pulls/1"},"html":{"href":"https://github.com/abhishekbundela/data-structures/pull/1"},"issue":{"href":"https://api.github.com/repos/abhishekbundela/data-structures/issues/1"},"comments":{"href":"https://api.github.com/repos/abhishekbundela/data-structures/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/abhishekbundela/data-structures/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/abhishekbundela/data-structures/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/abhishekbundela/data-structures/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/abhishekbundela/data-structures/statuses/b11d8c2179f4956558b1bdc4d5ca2a80e141a4c9"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":0,"review_comments":0,"commits":10,"additions":2468,"deletions":0,"changed_files":8}}